cryptomax
cryptomax8mo ago

Does setting a fresh realtime component upon entering a room model fire a didchange event?

It seems like it should, but the behavoir i'm getting at the moment seems like it is not. There was a bug fix in normcore for a didchange vent that was failing to fire but I believe that is fixed in my version 2.7
3 Replies
kapa.ai
kapa.ai8mo ago
Hi @cryptomax. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- When a RealtimeComponent is first created, it starts with no model. Normcore populates it once we have successfully connected to the server (or instantly, if we're already connected) and calls OnRealtimeModelReplaced() to provide us with a copy of it. If this RealtimeComponent was previously mapped to a different model (e.g., when switching rooms), it will provide a reference to the previous model in order to allow your component to unregister from events. In this process, if a model is fresh, it is populated with the color of the MeshRenderer. Then, UpdateMeshRendererColor() is called to synchronize the color stored on the model to the MeshRenderer. If another client created this model, it will be populated with the values they set. Finally, the colorDidChange event is registered that calls the ColorDidChange method whenever the model's color property changes. That way, if the color changes later, you’ll be notified so you can update your mesh renderer. However, it's important to note that Normcore doesn’t send changes to the server immediately when you change ownership or the value on a model. Instead, it synchronizes at 20hz and sends the latest state. If you change something and then change it back immediately, nothing will be sent to the server. If you're not seeing the expected behavior, make sure your project has no compilation errors. If your project has any errors, any changes you make to the model will not be visible to the model editor. Here are the relevant sources for your reference: - Creating a RealtimeComponent subclass (https://normcore.io/documentation/realtime/synchronizing-custom-data#creating-a-realtimecomponent-subclass) - Common Questions (https://normcore.io/documentation/room/common-questions#sometimes-when-i-log-the-values-on-my-model-from-inside-of-valuedidchange-not-all-the-values-that-i-set-on-another-client-update-when-are-updates-sent-out-and-how-are-they-applied) - RealtimeModel (https://normcore.io/documentation/reference/classes/Normal.Realtime.RealtimeModel) - Common Questions (https://normcore.io/documentation/room/common-questions#i-made-changes-to-my-properties-but-when-i-recompile-the-freshly-compiled-model-isnt-updated-why) ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai8mo ago
<@401986039964631060> kapa.ai is still learning and improving, please let us know how it did by reacting below
maxweisel
maxweisel8mo ago
what do you mean setting a fresh realtime component?