Skip to main content

Room

Manage and access information about current room. Each session of an SDK world is called Room. The players belonging to the same room, can see each other, hear each other, and synchronously effected by the events happening in the said room.

Members

Static Properties

NameDescription
Room.OnAudioChannelUpdateCalled when channel policy gets updated on the server.
Room.OnMasterClientSwitchedEvent triggered when the room master client switches. New master client player is passed with this event.
Room.OnPlayerJoinEvent handler that gets invoked when a new player joins the room.
Room.OnPlayerLeftEvent handler that gets invoked when a player leaves the room.
Room.PlayerCountNumber of players in current room.
Room.ServerTimeThe time of room instance synchronized by the server. All clients in the current room will have the same value. Useful for creating timers or events.

Static Methods

NameDescription
Room.FindPlayerByActorNumber(ActorID)Looks for the player in room with specific actor id.
Room.FindPlayerByGuid(guid)Finds player with the given Guid.
Room.FindPlayerByName(name)Looks for the player in room with a specific name.
Room.FindPlayerByNetworkID(NetworkID)Looks for the player in room with specific network id.
Room.FindPlayerCloseToPosition(location)Looks for the player which is closest to the specified location.
Room.FindPlayersInBounds(bounds)Finds list of players which are inside the specified cubic volume defined by bounds.
Room.FindPlayersInCollider(collider )Finds list of players which are inside the specified collider. Uses the volume defined by Bounds of the collider. Same as FindPlayersInBounds.
Room.FindPlayersInsideVolume(center, radius)Finds list of players which are inside the specified spherical volume defined by center and radius.
Room.GetAllPlayers()Returns an array of all players in current room.
Room.GetChannelPolicy(channelID)Gets the channel policy of the specified channel, if it exists.
Room.GetLocalPlayer()Returns the local player. The local player means the player that is getting controlled by this running client.
Room.RunForAnyPlayer(function)Assigns a function to run once for every player object when instantiated. This include the local player, players that were in the room before the local player, and for any player who will join later. The function will be triggered after the full instantiation of the player, so all the player components are present. The function will provide the related MLPlayer object.
Room.TryCreateOrUpdateChannel(channelID, channelPolicy)Create a channel with the given channel policy if it doesn't exist. Otherwise, updates the channel policy. Changes become active not immediately but when the server executes this operation (approximately RTT/2).
Room.TryGetChannelPolicy(channelID)Gets the channel policy of the specified channel, if it exists.
Room.TryRemoveChannel(channelID)Remove a channel, if it exists.