destroy object with only realtime view
how do i destroy an object that has a realtime view but not a realtime transform?
10 Replies
Hi @gewoon_kiefer. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
To destroy an object that has a RealtimeView but not a RealtimeTransform, you should use the
Realtime.Destroy()
method rather than Unity's standard GameObject.Destroy()
method. This ensures that the object is properly destroyed across all clients in the room.
Here's how to do it:
Both approaches will work the same way. The Realtime.Destroy()
method must be used instead of Unity's GameObject.Destroy()
for any objects that were instantiated with Realtime.Instantiate()
or that have a RealtimeView component Room > Ownership and Lifetime Flags.
It's worth noting that if the object is owned by another client and has preventOwnershipTakeover
set to true, you may not be able to destroy it unless you're the owner. In such cases, it's generally recommended to have the client that owns the object destroy it:
This approach helps prevent errors that can occur when multiple clients try to destroy the same object simultaneously Room > Common Questions.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@899009432518803496> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
i git this error:
can't destroy scene views and can't destroy stuff before proper connection
i properly connected
you can only destroy stuff instantaited at runtime
so i would need to spawn the object i want to destroy before i can destroy it?
if you need to destroy a scene object you can hide it instead
oke
how do you sync the ?
make a model with a bool and a target object