Dispatched when the number of users and/or spectators changes in a room within the current zone.
This event allows to keep track in realtime of the status of all the zone rooms in terms of users and spectators.
In case many rooms are used and the zone handles a medium to high traffic, this notification can be turned off to reduce bandwidth consumption, since a message is broadcasted to all users in the zone each time a user enters or exits a room.
This event allows to keep track in realtime of the status of all the zone rooms in terms of users and spectators.
In case many rooms are used and the zone handles a medium to high traffic, this notification can be turned off to reduce bandwidth consumption, since a message is broadcasted to all users in the zone each time a user enters or exits a room.


Version:
SmartFoxServer Basic / Pro

The following example shows how to check the handle the spectator switch notification.
CopyC#

SFSEvent.onUserCountChange += OnUserCountChange; public void OnUserCountChange(Room room) { // Assuming this is a game room string roomName = room.GetName() int playersNum = room.GetUserCount() int spectatorsNum: = room.GetSpectatorCount() Debug.WriteLine("Room " + roomName + "has " + playersNum + " players and " + spectatorsNum + " spectators"); }
