xulipa
xulipa4mo ago

Prevent ownership toggle

Prevent ownership takeover is not showing in the inspector panel anymore
7 Replies
kapa.ai
kapa.ai4mo ago
Hi @xulipa. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- The preventOwnershipTakeover is a property of the RealtimeView component in NormalVR. If it's not showing up in the Unity inspector, it could be due to a few reasons: 1. The RealtimeView component is not attached to the game object you're inspecting. Make sure the game object has a RealtimeView component. 2. You're inspecting a prefab that doesn't have RealtimeView instantiated via Realtime.Instantiate(). The preventOwnershipTakeover property is only applicable to the RealtimeViews that exist in the scene or instantiated via Realtime.Instantiate(). 3. There might be an issue with the version of NormalVR you're using. Make sure you're using the latest version of the NormalVR SDK. If you're still having trouble, you can control the preventOwnershipTakeover property programmatically. Here's an example:
RealtimeView myObjectView = myObject.GetComponent<RealtimeView>();
myObjectView.preventOwnershipTakeover = true;
RealtimeView myObjectView = myObject.GetComponent<RealtimeView>();
myObjectView.preventOwnershipTakeover = true;
This will prevent other clients from taking over ownership of the RealtimeView unless it has no owner. For more information, you can refer to the NormalVR documentation (https://normcore.io/documentation/room/ownership-and-lifetime-flags#prevent-ownership-takeover-of-a-realtimeview). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai4mo ago
<@725231244169707600> kapa.ai is still learning and improving, please let us know how it did by reacting below
NormalMark
NormalMark3mo ago
It only shows for root scene views, it's absent for prefab views Can you describe your use case, are you trying to change it at runtime through the inspector?
xulipa
xulipaOP3mo ago
Ahh makes sense. I have a prefab I instantiate after connection. However it's behaving a bit strange since when I'm using the weapon it has a vibrate script but my controller also vibrates when the other players are using it (this might be solvable with checking isOwnedLocallySelf in script?). Also I tried with having the weapon childed in the XR rig on the hand, but then it would show up with a big offset etc. So not sure what's the best way to spawn in objects in the hand of the player.
Mechabit
Mechabit3mo ago
1. use ownership check to prevent unowned objects from running scripts 2. Realtime Transform doesn't support parenting what you do is create a dummy child object in your hand and then copy the position and rotation to the gun every frame instead of parenting it
xulipa
xulipaOP3mo ago
Should I check ownership of Realtime.Transform only or also of Realtime.View? Ohh yeah that's what I thought. Thanks I previously thought sometime like this would be a bit too hacky, but since as you mentioned RT doesn't support parenting, this must be the best solution
Mechabit
Mechabit3mo ago
RT if it has one