HaRrY
HaRrY2w ago

Realtime.Destroy On owned realtime prefabs.

Can I destroy a RealtimePrefab by calling Realtime.Destroy even if someone else is an owner? Or do I have to take ownership first before destroying. I know it would destroy but I am thinking more like what will happen in the datastore?
3 Replies
kapa.ai
kapa.ai2w ago
Hi @Harris Saleem. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- In NormalVR, the recommended practice is to have the client that owns the object destroy it. This is to prevent issues that can occur when multiple clients attempt to delete the same model from a RealtimeSet at the same time. If multiple clients call Realtime.Destroy() on the same object at the same time, it can lead to errors. Here is the recommended way to destroy an object:
if (realtimeView.isOwnedLocally) Realtime.Destroy(gameObject);
if (realtimeView.isOwnedLocally) Realtime.Destroy(gameObject);
This code checks if the realtimeView is owned locally, and if it is, it calls Realtime.Destroy() on the gameObject. This ensures that only the owner of the object can destroy it, preventing potential conflicts. In terms of what happens in the datastore, if the destroyWhenOwnerLeaves or destroyWhenLastClientLeaves flags are set to true, the model will be destroyed when the owner of the model leaves the room or when the last client in the room leaves, respectively. If these flags are not set, the model will persist in the datastore even after the client disconnects. For more information, you can refer to the following documentation: - Destroy a prefab when a client disconnects (https://normcore.io/documentation/room/ownership-and-lifetime-flags#destroy-a-prefab-when-a-client-disconnects) - Common Questions (https://normcore.io/documentation/room/common-questions#im-getting-the-error-server-attempted-to-delete-value-from-set-for-key-that-doesnt-exist-in-storage-this-is-a-bug-how-do-i-fix-this) - RealtimeView Properties (https://normcore.io/documentation/reference/classes/Normal.Realtime.RealtimeView) ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2w ago
<@250518782341021697> kapa.ai is still learning and improving, please let us know how it did by reacting below
maxweisel
maxweisel2w ago
It will be destroyed and cleared from the datastore properly
More Posts
How can I distort the mic audio in RealtimeAvatarVoice to be higher or lower pitch?Is it possible to distort the mic audio from RealtimeAvatarVoice so the player is heard with a squeaAre there any best practices for syncing a large number of variables in one script?For instance if we have a large script with many bools floats, integers etc and they all need to be First player isn't synced to other players, while other players are visible to the first playerNo idea why this started happening - didn't change any code from what I can tell, but now whenever aReadStream was expecting to read a Null type from the stream, but was asked to read a Model typeI started getting this error in my game when I started disconnecting from it by closing the app. My Show the property path for RealtimeSet delta update errorsSometimes I'll get an error from normcore like `RealtimeSet received delta update for non-existent kHow can I disconnect another player from the gameI need to disconnect a player with another player. Can I do that?Delayed room updatesWe were in the process of testing our game with roughly 18 people per room, and we noticed that dataServer MirroringFor spectator sidecars, if you go beyond the x-large server bandwidth, the only option is to stream How to limit VR lag between room switchesWhen switching rooms there's a significant lag where the vr glasses basically freeze before the new More Connection eventsPlease implement more connection events, especially failure or error events like 'didConnectToRoomFa