Skip to content

API > Room


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⚓︎

Name Description
Room.OnAudioChannelUpdate Static fieldPropertyReadonly Property Called when channel policy gets updated on the server.
Room.OnPlayerJoin Static fieldPropertyReadonly Property Event handler that gets invoked when a new player joins the room.
Room.OnPlayerLeft Static fieldPropertyReadonly Property Event handler that gets invoked when a player leaves the room.
Room.PlayerCount Static fieldPropertyReadonly Property Number of players in current room.

Static Methods⚓︎

Name Description
Room.FindPlayerByActorNumber(ActorID) Static fieldMethod Looks for the player in room with specific actor id.
Room.FindPlayerByGuid(guid) Static fieldMethod Finds player with the given Guid.
Room.FindPlayerByName(name) Static fieldMethod Looks for the player in room with a specific name.
Room.FindPlayerByNetworkID(NetworkID) Static fieldMethod Looks for the player in room with specific network id.
Room.FindPlayerCloseToPosition(location) Static fieldMethod Looks for the player which is closest to the specified location.
Room.FindPlayersInBounds(bounds) Static fieldMethod Finds list of players which are inside the specified cubic volume defined by bounds.
Room.FindPlayersInCollider(collider ) Static fieldMethod 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) Static fieldMethod Finds list of players which are inside the specified spherical volume defined by center and radius.
Room.GetAllPlayers() Static fieldMethod Returns an array of all players in current room.
Room.GetChannelPolicy(channelID) Static fieldMethod Gets the channel policy of the specified channel, if it exists.
Room.GetLocalPlayer() Static fieldMethod Returns the local player. The local player means the player that is getting controlled by this running client.
Room.RunForAnyPlayer(function) Static fieldMethod 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) Static fieldMethod 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) Static fieldMethod Gets the channel policy of the specified channel, if it exists.
Room.TryRemoveChannel(channelID) Static fieldMethod Remove a channel, if it exists.