RealtimeDictionary events

if a RealtimeDictionary is set directly, will the modelReplaced event fire? For example:
model.floats[(uint)key].value = value;
model.floats[(uint)key].value = value;
will the model.floats model dispatch an event?
2 Replies
kapa.ai
kapa.ai4w ago
Hi @Ryan Green | MONA. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- The RealtimeDictionary in NormalVR has several events that can be triggered, including modelAdded, modelReplaced, and modelRemoved. These events fire when a model is added, replaced, or removed respectively, either locally or remotely. According to the documentation (https://normcore.io/documentation/reference/classes/Normal.Realtime.Serialization.RealtimeDictionary%601), a model is considered replaced (as opposed to removed and added) if a new model is added that overwrites an existing model under the same key. So, if you are setting a value directly to a key that already exists in the RealtimeDictionary (i.e., the model already exists under that key), it should trigger the modelReplaced event. However, please note that the actual behavior might depend on the specific implementation and usage in your application. It's always a good idea to test this in your application to confirm the behavior. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai4w ago
<@337874773742845953> kapa.ai is still learning and improving, please let us know how it did by reacting below