2 Replies
Hi @fgamez1020. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
To detect when a user disconnects from a room in NormalVR, you can use the
RealtimeAvatarManager
component. This component provides events that notify you when avatars (representing users) are created or destroyed in the room. Specifically, you can use the avatarDestroyed
event to detect when a user disconnects.
Here's how you can implement this:
In this code, we subscribe to the avatarDestroyed
event of the RealtimeAvatarManager
. When a user disconnects, their avatar is destroyed, triggering this event. The AvatarDestroyed
method will be called, allowing you to handle the disconnection.
Remember to attach this script to the same GameObject that has the RealtimeAvatarManager
component.
It's worth noting that this method detects user disconnections indirectly through avatar destruction. According to the documentation, when a client crashes or their connection is dropped suddenly, the server will disconnect them after five seconds. Any models they own that are tagged with destroyWhenOwnerLeaves
will be automatically destroyed.
Realtime > Xr > Avatars
Architecture > Common Questions
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@1053407831916822528> Kapa.ai is still learning and improving, please let me know how I did by reacting below.