Oliver
Oliver2d ago

Strange function call in auto-generated model code

Really not sure what's going on here, but it seems like one of the FireChanged functions in the auto-generated model code is somehow getting a reference to one of my scripts and calling a function on it. I get this output: begining lobby load UnityEngine.Logger:Log(LogType, Object) UnityEngine.Debug:Log(Object) levelLoader:beginLobbyLoad() policeStationModel:FireOnSceneDidChange(Boolean) Normal.Realtime.RealtimeModel:SafeInvokeDynamicOnDidRead(StreamContext&) Normal.Realtime.Room:SafeDispatchOnDidRead(StreamContext&) Normal.Realtime.Room:ReceivedPersistenceMessage(IClient, Int32, Byte[], UInt32, Boolean) Normal.Realtime.Native.Client:ReceivePersistenceMessages() Normal.Realtime.Native.Client:ReceiveIncomingMessages() Normal.Realtime.Room:ClientTick() Normal.Realtime.Room:Tick(Double) Normal.Realtime.Realtime:Update() I have checked policeStationModel:FireOnSceneDidChange and it has no reference to levelLoader. The function that it does call doesn't interact in any way with the levelLoader object, or have any reference to it. I have no idea how or why it's calling the beginLobbyLoad function, but it's causing big problems in my game. The only explanation I can think of is something weird happening with the log output, because this seems unexplainable. But I have multiple logs just like this which all agree on the call order. Any ideas?
4 Replies
kapa.ai
kapa.ai2d ago
Hi @Oliver. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Based on the information in the knowledge sources, there is no explicit documentation describing how auto-generated model code in Normcore (NormalVR) would directly call unrelated functions (like your levelLoader:beginLobbyLoad) from within a FireChanged or FireOnSceneDidChange method. The auto-generated model code is designed to synchronize data and fire events related to model changes, typically using C# events or callbacks that you subscribe to in your own scripts. The stack trace you provided shows that FireOnSceneDidChange is being called as part of the model update/read process, which is expected behavior for Normcore's event system. However, there is no indication in the documentation that Normcore's code would somehow invoke unrelated methods (such as beginLobbyLoad) unless you have explicitly subscribed those methods to a model event or callback. A few things to check based on best practices and the documentation: - Ensure that you have not accidentally subscribed beginLobbyLoad (or any method from levelLoader) to an event or delegate on policeStationModel or its model events. - Review your event subscriptions, especially if you are using C# events or UnityEvents, to make sure there are no unintended connections. - The log output order is consistent with how Unity and Normcore dispatch events, but there is no evidence in the documentation that Normcore would "magically" find and call unrelated methods. If you are seeing this behavior and cannot find any code that subscribes beginLobbyLoad to a model event, it is possible that there is a logging or stack trace confusion, but the knowledge sources do not provide enough information to confirm this or to explain the exact cause. In summary:
I'm sorry, but the knowledge sources do not contain enough information to explain why your auto-generated model code would call an unrelated function like beginLobbyLoad. The most likely explanation is an unintended event subscription or a logging/stack trace artifact, but this cannot be confirmed from the documentation provided. Please double-check your event subscriptions and consider isolating the issue with minimal code to reproduce the problem. If the issue persists, you may want to reach out to Normcore support or review your Unity event wiring in detail. For more on how model events and callbacks work, see the RealtimeModelEvent documentation and the Synchronizing Custom Data guide. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2d ago
<@259433892119969792> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Oliver
OliverOP2d ago
For reference I have checked that there are no incorrect subscriptions to onSceneDidChange
maxweisel
maxweisel21h ago
strange. that autogenerated code just fires a C# event. I don’t know how else this could happen without an event subscription

Did you find this page helpful?