Unity uClientCore > URoomListener

URoomListener Interface




onAddClient(e) Occurs when a client is added to the room. When the current client joins a room, onAddClient() fires once for each client already in that room. To ignore onAddClient() event notifications for clients already in the room, use URoom.clientListInited(), which returns true only after the room has fired onAddClient() for all clients in it at the time it was joined.
onJoin(e) Occurs when the current client joins the room (in response to an earlier call to URoom.join()).
onLeave(e) Occurs when 1) the current client leaves the room in response to an earlier call to URoom.leave(), 2) the current client is forced out of the room by the server, or 3) the room is removed while the current client is in it. Applications should use onLeave() to disable or delete resources (such as a GUI) when a client leaves a room.
onNumClients(e) Occurs when the number of clients in the room changes, or when Unity sends a response to an explicit request for a client count via URoom.getNumClients(). When the current client client joins a room, onNumClients() will fire once for each client already in that room (as each client is added individually to the room's client list).
onRemoveClient(e) Occurs when a client is removed from the room.
onUpdateClientAttribute(e) Occurs when a shared client attribute changes for a client in the room. The new value can be accessed via URoomEvent.getChangedAttr().
onUpdateRoomAttribute(e) Occurs when a shared room attribute changes. The new value can be accessed via URoomEvent.getChangedAttr().


The URoomListener interface's methods correspond to specific URoom events. Classes wishing to process URoom events implement this interface. An instance of an implementing class must register to receive event notifications from a specific URoom instance with the URoom.addURoomListener() method. When a URoom event occurs, the URoom instance invokes the appropriate URoomListener method on all registered listeners. Information about the event is passed to the method in a URoomEvent object.

Documentation Version