beeeen
beeeen2mo ago

In-editor references disappear

We find that if we reference a prefab in the editor (such as dragging & dropping it into a public gameobject field), everything will work fine UNLESS the prefab is in the Normal/Resouces folder. In that case, there's a possiblity that the reference will be "broken" or dissapear. This happens to us frequently. Even the RealtimeAvatarManager script which requires a reference to the LocalAvatarPrefab will possibly lose this reference if changes are made to the prefab. Any ideas on what's going on here and how to fix it?
4 Replies
kapa.ai
kapa.ai2mo ago
Hi @beeeen. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Hmm, I don't know enough to give you a confident answer yet. However, based on the information provided, it seems like the issue might be related to how Unity handles prefabs and references. In Normcore, a realtime prefab must live in a Resources folder to ensure it can be loaded at runtime. A realtime prefab must be instantiated with Realtime.Instantiate() to ensure it is instantiated on all clients. A realtime prefab must also have a RealtimeView component on the root GameObject. If you would like to avoid using Resources, it is possible to use the Addressables API or a custom loader by implementing a RealtimePrefabLoadDelegate (https://normcore.io/documentation/guides/recipes/using-addressables) (source (https://normcore.io/documentation/realtime#prefabs)). As for the RealtimeAvatarManager, all avatar prefabs that are used with it need to include a RealtimeAvatar component on the root of the prefab. The RealtimeAvatar component is responsible for synchronizing the head + hands positions and active states (source (https://normcore.io/documentation/realtime/xr/avatars#realtimeavatar)). If you're still experiencing issues, I would recommend checking the Unity and Normcore documentation or reaching out to their support for more specific guidance. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2mo ago
<@690217885540417680> kapa.ai is still learning and improving, please let us know how it did by reacting below
NormalMark
NormalMark2mo ago
Are you talking about references in the inspector? Ex screenshot. Can you confirm if the .meta file contents of the prefabs in Resources have changed when this happens? Or if the references inside the prefab/scene text files referencing them have changed? This is usually visible in source control. It would narrow down where to investigate. Normcore relies on the Resources folder to resolve prefabs by name when instantiating them. But afaik it's not doing anything else like processing them.
No description
Mechabit
Mechabit2mo ago
by normal/resources folder are you talking about the packages folder? can you try just putting it in assets/resources folder?