RealtimeViewModel was deleted from datastore, but has no corresponding prefab

Realtime: RealtimeViewModel was deleted from datastore, but has no corresponding prefab. This is a bug. UnityEngine.Debug:LogError (object) Normal.Realtime.Realtime:PrefabRealtimeViewModelRemoved (Normal.Realtime.Datastore,Normal.Realtime.RealtimeViewModel,bool) Normal.Realtime.Datastore:PrefabViewModelRemovedFromSet (Normal.Realtime.Serialization.RealtimeSet1<Normal.Realtime.RealtimeViewModel>,Normal.Realtime.RealtimeViewModel,bool) Normal.Realtime.Serialization.RealtimeSet1<Normal.Realtime.RealtimeViewModel>:SafeDispatchModelRemoved (Normal.Realtime.RealtimeViewModel,bool) How can i fix this issue ?
3 Replies
kapa.ai
kapa.ai2d ago
Hi @Trần Tiến Đạt. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- This error occurs when a RealtimeViewModel is removed from the datastore, but there's no corresponding prefab instance in the scene. This is typically a synchronization issue between the datastore and the scene objects. To address this issue, you can try the following steps: 1. Ensure proper instantiation: Always use Realtime.Instantiate() instead of Unity's GameObject.Instantiate() when creating Normcore prefabs. This ensures that the prefab is properly synchronized across all clients. Here's an example:
GameObject myObject = Realtime.Instantiate("My Object", ownedByClient: true);

GameObject myObject = Realtime.Instantiate("My Object", ownedByClient: true);

Realtime API provides more details on proper instantiation. 2. Check ownership and destruction: Make sure that only the client that owns an object is destroying it. You can do this by checking ownership before calling Realtime.Destroy():
if (realtimeView.isOwnedLocally)
{
Realtime.Destroy(gameObject);
}

if (realtimeView.isOwnedLocally)
{
Realtime.Destroy(gameObject);
}

This helps prevent multiple clients from trying to destroy the same object simultaneously, which can lead to synchronization issues. 3. Update Normcore: If you're using an older version of Normcore, consider updating to the latest version. Newer versions often include bug fixes and improvements that might resolve this issue. 4. Check for race conditions: Ensure that you're not destroying objects immediately after instantiating them or in rapid succession, as this can sometimes lead to synchronization issues. 5. Verify prefab setup: Make sure your prefab is correctly set up with a RealtimeView component on the root GameObject and is located in a Resources folder (or is properly addressable if you're using a custom prefab loading system). If the issue persists after trying these steps, it might be a bug in Normcore itself. In that case, you should report the issue to the Normcore support team with a detailed description of how to reproduce the problem. Common Questions in the Normcore documentation provides more information on dealing with similar issues and best practices for using Normcore. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2d ago
<@1152048129353461810> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
maxweisel
maxweisel2d ago
This is usually caused by trying to call Realtime.Destroy on the same prefab across multiple clients Try using RealtimeView isOwnedLocally to verify you’re only calling Destroy on the owner’s client

Did you find this page helpful?