What happens when you set prevent ownership take over and that person disconnects?
What happens when you set prevent ownership take over on a view and that person disconnects? Is the view locked forever?
3 Replies
Hi @Mechabit. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
When the
preventOwnershipTakeover
flag is set to true on a RealtimeView, it means that the server will deny any client's attempt to change the ownership of an object in that model unless it has no owner. If the owner of the view disconnects, the behavior of the view depends on the settings of other flags.
If the destroyWhenOwnerLeaves
flag is set to true, the model will be destroyed when the owner of the model leaves the room. This means that if the owner disconnects, the server will automatically destroy the model.
However, if destroyWhenOwnerLeaves
is not set, the model will not be destroyed when the owner disconnects. In this case, the model will remain in the state it was in when the owner disconnected, and no other client will be able to take over ownership unless the preventOwnershipTakeover
flag is set to false.
It's worth noting that the preventOwnershipTakeover
flag can be changed at runtime, so it's possible to change this setting to allow another client to take ownership after the original owner has disconnected.
Sources:
- Prevent ownership takeover of a RealtimeView (https://normcore.io/documentation/room/ownership-and-lifetime-flags#prevent-ownership-takeover-of-a-realtimeview)
- Destroy a prefab when a client disconnects (https://normcore.io/documentation/room/ownership-and-lifetime-flags#destroy-a-prefab-when-a-client-disconnects)
- RealtimeModel Properties (https://normcore.io/documentation/reference/classes/Normal.Realtime.RealtimeModel)
- Ownership + Lifetime Flags (https://normcore.io/documentation/realtime/realtimeview#ownership--lifetime-flags)
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@162940911964258305> kapa.ai is still learning and improving, please let us know how it did by reacting below
this answer is wrong
if preventOwnershipTakeover is true, but the model has no owner, anyone can take ownership but then it’s locked to them.