Can you get a client id directly from realtimetransform?
Can you get a client id directly from realtimetransform?
26 Replies
Hi @cryptomax. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
No, you cannot directly get a client ID from
RealtimeTransform
. However, you can get the client ID from the RealtimeComponent
or RealtimeView
that owns the RealtimeTransform
.
You can use the ownerIDSelf
property of the RealtimeComponent
or RealtimeView
to get the client ID of the component owner. Here's an example of how you might do this:
Please note that accessing these properties before Start
is unreliable.
For more information, you can refer to the RealtimeComponent (https://normcore.io/documentation/reference/classes/Normal.Realtime.RealtimeComponent%601) and RealtimeView (https://normcore.io/documentation/reference/classes/Normal.Realtime.RealtimeView) documentation.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@401986039964631060> kapa.ai is still learning and improving, please let us know how it did by reacting below
@Normcore Assistant the view is not usually owned so that would not tell us the client id of the realtime transform owner though
Let me check the knowledge base for you. One moment! :books:
----------------------
You're correct. The
RealtimeTransform
component and the RealtimeView
can have different owners. If you want to get the client ID of the owner of the RealtimeTransform
, you should use the ownerIDSelf
property of the RealtimeTransform
itself, not the RealtimeView
.
Here's how you can do it:
This will give you the client ID of the current owner of the RealtimeTransform
. If the RealtimeTransform
is not owned by any client, ownerIDSelf
will return -1
.
For more information, you can refer to the RealtimeComponent (https://normcore.io/documentation/reference/classes/Normal.Realtime.RealtimeComponent%601) documentation.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@401986039964631060> kapa.ai is still learning and improving, please let us know how it did by reacting below
The client ID of the RT owner? Yeah, just
model.ownerIDSelf
I have a terrible memory and forget what properties i can get to from where 😦
yeah fair honestly
But yeah you can just do
rt.ownerIDSelf
additionally isOwnedLocallySelf and isOwnedRemotelySelfisn't intelisense supposed to tell you these things if you just rt.?
Yeah
Does it not show for yours?
well for me it doesn't
Check the properties (wrench icon)
I can manually trigger it using crtl space but even then it just shows abc items instead of wrenches, and I dont have the little icones you do there
I'm using VS2022
ah not vs code?
nah
Works better with Unity in my experience
I guess that is probably my problem then heh
I used to use VScode but it kept breaking with every update and then switched to VS and never looked back. much better support for unity as Camobiwan says.
eh i guess I liked it becuase it's lightweight and i'm an artist not a programmer so it's a miracle I'm even coding as it is XD
I often code just from the colors the text is
hears someone die in the background
hahahah
it's actually true though you would be shocked
im impressed
I started with mono which was pretty lightweight and thought vsCode would be too but it's just not as good as VS
well mayeb I will look into it, even just having proper intelisense would be handy
VS got a reputation for being "bloated" which I don't think is deserved. It's certainly a lot more packed than VSCode but the integrations are just so much better / seamless
I didn't have to do anything to get the properties / intellisense to show up, just set the editor to it in your Unity preferences