cryptomax
cryptomax8mo ago

RealtimeView doesn't have a connected property?

It appears RealtimeView doesnt' have a connected property, whats the best way to get connection state from it?
2 Replies
kapa.ai
kapa.ai8mo ago
Hi @cryptomax. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- The RealtimeView class in NormalVR does not have a connected property. However, the Realtime class does have a connected property. This property indicates if the Realtime instance is connected and its views are initialized. To check the connection state, you would need to access the Realtime instance that is managing the component. This can be done using the realtime property of the RealtimeView or RealtimeComponent. Here's an example:
Realtime realtime = yourRealtimeViewOrComponent.realtime;
if (realtime != null && realtime.connected)
{
// The Realtime instance is connected and its views are initialized.
}
Realtime realtime = yourRealtimeViewOrComponent.realtime;
if (realtime != null && realtime.connected)
{
// The Realtime instance is connected and its views are initialized.
}
Please note that accessing the realtime property before Start() is called can be unreliable. If you're dealing with a prefab, all views and components are initialized with their models by the time Start() is called on any script on the prefab. If you're dealing with a RealtimeView that exists in a scene file, you'll need to wait until realtime.connected == true, or the didConnectToRoom event has fired. For more information, please refer to the RealtimeView documentation (https://normcore.io/documentation/reference/classes/Normal.Realtime.RealtimeView) and the Realtime documentation (https://normcore.io/documentation/reference/classes/Normal.Realtime.Realtime). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai8mo ago
<@401986039964631060> kapa.ai is still learning and improving, please let us know how it did by reacting below