MasterOX 水
MasterOX 水4mo ago

how to see if player is connected to room

how can i get a bool that tells me if the player is connected to a room or not
2 Replies
kapa.ai
kapa.ai4mo 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: ---------------------- You can check if a player is connected to a room by using the connected property of the Realtime class in NormalVR. This property returns a boolean value indicating whether the Realtime instance is connected and its views are initialized. Here is an example of how you can use it:
using Normal.Realtime;

public class YourClass
{
private Realtime _realtime;

private void Awake()
{
_realtime = GetComponent<Realtime>();
}

private void Update()
{
if (_realtime.connected)
{
// The player is connected to the room
}
else
{
// The player is not connected to the room
}
}
}
using Normal.Realtime;

public class YourClass
{
private Realtime _realtime;

private void Awake()
{
_realtime = GetComponent<Realtime>();
}

private void Update()
{
if (_realtime.connected)
{
// The player is connected to the room
}
else
{
// The player is not connected to the room
}
}
}
In this example, _realtime.connected will return true if the player is connected to the room, and false otherwise. For more information, you can refer to the Realtime class 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.ai4mo ago
<@758040514678489279> kapa.ai is still learning and improving, please let us know how it did by reacting below