NeuroGoblin
NeuroGoblin2mo ago

Realtime OnChanged event will not fire

Hey guys, I have a simple model, SceneModel, which has one integer property, amountOfSceneChanges. When this integer increments, I want the delegate to fire. I have tried: - Verifying the model is subscribed to the event on load, and even manually resubscribing right before the call - Verifying that the model integer number is infact changing - Recreating the model and modelsync classes (with different names) recompiling and using the new classes - Changing room name I have no idea why the delegate isn't firing given the above. Please let me know if you need more screenshots or info! thanks !
No description
No description
26 Replies
kapa.ai
kapa.ai2mo ago
Hi @NeuroGoblin. 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 provided in the knowledge sources, there are a few things you could check: 1. Change Event: In the RealtimeModel, there is an optional argument that specifies whether you would like a change event added to the model. When this is set to true, a C# event that will fire when a property is changed locally or remotely is added to the model by the model compiler. This is a useful signal to update your scene to match the model. Make sure this is set to true in your case. Source (https://normcore.io/documentation/room/realtimemodel#change-event) 2. Compilation Errors: 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. Source (https://normcore.io/documentation/room/common-questions#i-made-changes-to-my-properties-but-when-i-recompile-the-freshly-compiled-model-isnt-updated-why) 3. RealtimeComponent Syncing: If your custom RealtimeComponent isn't syncing and OnRealtimeModelReplaced doesn't get called, you might have added your custom component to a game object before it was converted to a RealtimeComponent subclass. To verify this, look at the RealtimeView's list of components and make sure you see your custom component in the list. If you don't see it, or a RealtimeView has not been created for you automatically, try removing the component and re-adding it to your game object. This will tell Unity to automatically create a RealtimeView and add your RealtimeComponent subclass to its component list. Source (https://normcore.io/documentation/realtime/synchronizing-custom-data#my-custom-realtimecomponent-isnt-syncing-and-onrealtimemodelreplaced-doesnt-get-called) If you've checked all of these and the issue persists, it might be helpful to provide more information or screenshots for further troubleshooting. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2mo ago
<@196555254496493568> kapa.ai is still learning and improving, please let us know how it did by reacting below
NeuroGoblin
NeuroGoblin2mo ago
@Normcore Assistant I have tried all 3
kapa.ai
kapa.ai2mo ago
Let me check the knowledge base for you. One moment! :books: ---------------------- I'm sorry to hear that you're still having trouble. Based on the information provided in the knowledge sources, here are a few more things you could try: 1. RealtimePropertyAttribute: Ensure that your amountOfSceneChanges property has the **RealtimeProperty] attribute. This attribute is necessary for Normcore to recognize the property and synchronize it. [Source (https://normcore.io/documentation/reference/classes/RealtimePropertyAttribute) 2. PropertyID: The propertyID field in the RealtimePropertyAttribute is a unique identifier for each property. Make sure that each property in your model has a unique propertyID. Source (https://normcore.io/documentation/reference/classes/RealtimePropertyAttribute) 3. Reliable: The reliable field in the RealtimePropertyAttribute determines whether changes to the property are sent reliably (if set to true) or unreliably (if set to false). If it's set to false, changes might not always be sent. Try setting it to true to see if that helps. Source** (https://normcore.io/documentation/reference/classes/RealtimePropertyAttribute) If you've tried all of these and the issue persists, it might be a more complex issue that requires further troubleshooting. In that case, I would recommend reaching out to the Normcore support team for assistance. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2mo ago
<@196555254496493568> kapa.ai is still learning and improving, please let us know how it did by reacting below
Camobiwon
Camobiwon2mo ago
That's very strange and should be working, the only pattern difference I see with my stuff is setting the local variable before the model one, typically I just set the local var in the model one, or just reference the model value directly in my code But I realistically see no reason why this should be failing atm
NeuroGoblin
NeuroGoblin2mo ago
hey, thanks for the reply, I tried directly changing the model as well (model.amount++) and same thing
NeuroGoblin
NeuroGoblin2mo ago
also tried incrementing it by different amounts - in both cases the model is defs changing
No description
Camobiwon
Camobiwon2mo ago
Yeah honestly unsure :/ I would maybe see if some other very simple setup works in a different script, to make sure that the stuff is firing at all Well nvm, was gonna mention that you can't set a value to the same previous value and have it update, but it doesn't appear you are doing that ever
NeuroGoblin
NeuroGoblin2mo ago
no, it should always increment - also it's odd because i literally created a whole new model and sync script and same thing i remember having this issue when i was using booleans, it would only fire once then never again
Camobiwon
Camobiwon2mo ago
An entirely new setup is having the same issue?
NeuroGoblin
NeuroGoblin2mo ago
same scene / project, but new model (compiled manually) and new script referencing it
Camobiwon
Camobiwon2mo ago
Seems like something else externally may be failing, I gotta brb, but try reimporting the Normcore package and checking to make sure the object in the scene is setup correctly, perhaps the RealtimeView is breaking or something?
NeuroGoblin
NeuroGoblin2mo ago
So i switched the pre-release version (2.95) from the webGL alpha (as we were planning on doing anyway) and the issue persists
cryptomax
cryptomax2mo ago
it does in fact fire a first time though?
NeuroGoblin
NeuroGoblin2mo ago
No, it doesn't - but i just made a blank scene with nothing but my realtimeview and a realtime room and it worked so it's something in my scene setup
cryptomax
cryptomax2mo ago
you had a view on the same game obejct as hte model script right?
Mechabit
Mechabit2mo ago
maybe the scene changed before the message was sent? assuming you're using the message to tell other users to change scenes
NeuroGoblin
NeuroGoblin2mo ago
Ok I figured out the issue, the realtimeview had no owner i had to manually request ownership then call the change
Mechabit
Mechabit2mo ago
you can still sync messages with no owner was the root view owned by another user?
NeuroGoblin
NeuroGoblin2mo ago
oh you're right no it had no owner ok now im confused i switched to a new scene, did the above (it worked) then switched back and now it's working
Mechabit
Mechabit2mo ago
maybe something funky with the scene file
NeuroGoblin
NeuroGoblin2mo ago
some weird cache thing?
Mechabit
Mechabit2mo ago
could be a scene view uuid bug anyway, glad it's working
NeuroGoblin
NeuroGoblin2mo ago
very interesting, same thing happened again with a different model. I went into a new scene and did the above setup with the new model and it fixed it then it stopped working again, went back into that new scene, ran it once, and then the original scene started working again is it possible to manually force reset the UUID or whatever is causing this?
Mechabit
Mechabit2mo ago
you can edit the scene file in a text editor or you can instantiate your models as those don't use uuids