pcherner
pcherner2mo ago

Issues after updating Unity to version 2022

Hello! I'm working on a VR project in unity and have been using normcore to sync everything. I have been able to get custom model data flowing between users and everything seemed good, until I updated my unity version to be able to support some new shaders. Now I get errors when trying to access the RealtimeView Component in the editor and when trying to run the application. The in editor error is: TypeLoadException: Could not resolve type with token 010000a4 from typeref (expected class 'UnityEditor.Experimental.SceneManagement.PrefabStageUtility' in assembly 'UnityEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null') and the runtime error is: RealtimeView model is null. Was this view instantiated with GameObject.Instantiate instead of Realtime.Instantiate? Make sure you're passing a prefab name and not a prefab reference to avoid accidentally calling GameObject.Instantiate(). Let me know if anyone has run into any of this or has any ideas. I'm using Unity version 2022.3.10f1 and Normcore version 2.1 Thanks! -Phil
6 Replies
kapa.ai
kapa.ai2mo ago
Hi @pcherner. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Hello Phil, The error messages you're encountering seem to be related to how your RealtimeView and RealtimeComponents are being instantiated and accessed. The runtime error message suggests that you might be using Unity's Instantiate() method instead of Normcore's Realtime.Instantiate(). When using Normcore, it's important to use Realtime.Instantiate() to ensure that the prefab is instantiated on all clients and that all RealtimeComponents are connected together so that any state they synchronize will automatically be replicated to all clients. Here's how you should be instantiating your prefabs:
GameObject myObject = Realtime.Instantiate("My Object", ownedByClient: true);
GameObject myObject = Realtime.Instantiate("My Object", ownedByClient: true);
Source (https://normcore.io/documentation/room/ownership-and-lifetime-flags#realtimeinstantiate--ownedbyclient) As for the editor error, it might be related to how you're accessing the RealtimeView component. If you're dealing with a prefab, all views and components are initialized with their models and they will be ready to work with by the time Start() is called on any script on the prefab. If you're dealing with a RealtimeView that exists in a scene file, you'll need to wait until realtime.connected == true, or the didConnectToRoom event has fired. Source (https://normcore.io/documentation/realtime/common-questions#why-do-i-get-the-error-this-view-doesnt-have-a-model-yet-wait-until-the-model-is-present-before-interacting-with-the-ownership-when-interacting-with-realtimeview) If you're still encountering issues after checking these points, I recommend reaching out to the Normcore community on their Discord (https://normcore.io/documentation/essentials/common-questions#does-normcore-support-x-y-z) for further assistance. Best, kapa.ai ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2mo ago
<@285565574745161728> kapa.ai is still learning and improving, please let us know how it did by reacting below
maxweisel
maxweisel2mo ago
What Normcore version are you using in UPM? 2.1 is the asset store package which isn’t the actual version being used and what Unity version did you update from? I recognize this bug actually, this was fixed a long time ago. Make sure to update Normcore in Package Manager (make sure you’re looking at Packages and not My Assets) then restart Unity and you’ll be good to go
pcherner
pcherner2mo ago
Ah interesting. I made this project a couple of years ago and never updated anything so I actually think that I'm on version 2.1.10 and I can update to 3.0. Should I update to 3 and use that, or is there another version to use? Not sure if v3 has any big changes It looks like I can also update to 2.10.4 which seems like the most recent release
Mechabit
Mechabit2mo ago
v3 is for webgl alpha, use 2.10 also try reimporting scripts and packages and restarting the editor right-click reimport, not remove and reinstall, that doesn't work
pcherner
pcherner2mo ago
awesome that seems to have worked. thank you all so so much!!