MasterOX 水
MasterOX 水7mo ago

realtime.destroy problem

Realtime: Could not find RealtimeViewModel for RealtimeView in the datastore. Unable to destroy RealtimeView. UnityEngine.Debug:LogError (object)
3 Replies
kapa.ai
kapa.ai7mo ago
Hi @MasterOX 水. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- The error message you're seeing suggests that the RealtimeView you're trying to destroy with Realtime.Destroy() is not found in the datastore. This could happen if the RealtimeView was not properly registered with the datastore, which can occur if it was not instantiated using Realtime.Instantiate(). According to the NormalVR documentation (https://normcore.io/documentation/reference/classes/Normal.Realtime.Realtime), Realtime.Destroy() should be used to destroy a realtime prefab on all clients, and it can only be used with GameObjects that were instantiated with Realtime.Instantiate(). If you're trying to destroy a RealtimeView that was not instantiated using Realtime.Instantiate(), you may encounter this error. Make sure that the RealtimeView you're trying to destroy was instantiated correctly. Here's an example of how to correctly instantiate and destroy a RealtimeView:
// Instantiate
GameObject myObject = Realtime.Instantiate("MyPrefabName");

// Destroy
if (realtimeView.isOwnedLocally) {
Realtime.Destroy(myObject);
}
// Instantiate
GameObject myObject = Realtime.Instantiate("MyPrefabName");

// Destroy
if (realtimeView.isOwnedLocally) {
Realtime.Destroy(myObject);
}
If you're still encountering issues, it might be due to other factors such as a corrupt prefab in Unity, incorrect parent/child relationships in RealtimeView, or issues with the model setter in RealtimeComponent. You can refer to the Common Questions (https://normcore.io/documentation/realtime/common-questions#why-would-a-realtimecomponents-model-remain-null) section of the NormalVR documentation for more details. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai7mo ago
<@758040514678489279> kapa.ai is still learning and improving, please let us know how it did by reacting below
Mechabit
Mechabit7mo ago
can't destroy scene views this way, only instantiated prefabs