MasterOX 水
MasterOX 水6mo ago

request ownership

i forgot how to request ownership can u please tell me
3 Replies
kapa.ai
kapa.ai6mo ago
Hi @MasterOX 水. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- In NormalVR, you can request ownership of a component or model using the RequestOwnership() method. This method is available for RealtimeComponent, RealtimeModel, and RealtimeView classes. Here's an example of how to request ownership of a RealtimeTransform component:
// Get the RealtimeTransform component
RealtimeTransform realtimeTransform = myObject.GetComponent<RealtimeTransform>();

// Request Ownership
realtimeTransform.RequestOwnership();
// Get the RealtimeTransform component
RealtimeTransform realtimeTransform = myObject.GetComponent<RealtimeTransform>();

// Request Ownership
realtimeTransform.RequestOwnership();
(Source: normcore.io (https://normcore.io/documentation/room/ownership-and-lifetime-flags#requesting-ownership-of-any-realtimecomponent-or-realtimemodel)) You can also request ownership immediately when instantiating a new object using the ownedByClient field of Realtime.Instantiate():
GameObject myObject = Realtime.Instantiate("My Object", ownedByClient: true);
GameObject myObject = Realtime.Instantiate("My Object", ownedByClient: true);
(Source: normcore.io (https://normcore.io/documentation/room/ownership-and-lifetime-flags#realtimeinstantiate--ownedbyclient)) If you're debugging at runtime, the RealtimeView inspector in Unity includes Request Ownership and Clear Ownership buttons that function like calling RequestOwnership() or ClearOwnership() in code. (Source: normcore.io (https://normcore.io/documentation/room/ownership-and-lifetime-flags#at-runtime-with-the-unity-inspector)) ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai6mo ago
<@758040514678489279> kapa.ai is still learning and improving, please let us know how it did by reacting below
MasterOX 水
MasterOX 水OP6mo ago
thank you