Multiplayer Class

The component Multiplayer gives access to all functionality and communication for Alteruna Multiplayer.

Definition

Namespace: Alteruna
Assembly: Alteruna.Trinity (in Alteruna.Trinity.dll) Version: 1.3.4
C#
public class Multiplayer : MonoBehaviour, 
	IAdaptiveSerializableUniqueID, IUniqueID
Inheritance
Object    Object    Component    Behaviour    MonoBehaviour    Multiplayer
Implements
IAdaptiveSerializableUniqueID, IUniqueID

Remarks

Properties

AvailableRooms A list of all the currently available Rooms on the server.
CurrentRoom The Room we are currently connected to.
InRoom Whether currently connected to a Room.
Instance Static singleton instance of the Multiplayer component. Note that this feature may not work as intended when used in combination with the multi-client tool.
IsConnected Whether currently connected to a server.
Lockable 
LowestUserIndex The index of the user with the lowest index. Updates after the other joined and room joined events.
MaxPlayers The global maximum amount of players allowed in a single Room. Rooms can be created with a lower player limit, but not higher.
Me The User representing the local player.
NetworkStatistics Statistic on network data send and received in Kilobytes unless defined.
UID 
UIDString 

Methods

Connect Connect to the Alteruna service manually when the config ConnectOnStart is disabled.
CreatePrivateRoom Create a new private room.
CreateRoom Create a new room.
DeregisterCodec Deregister a Synchronizable from Alteruna Multiplayer, so that it is no longer being synchronized.
GetAllSynchronizables Get a list of all currently registered Synchronizables.
GetAllSynchronizables(ListSynchronizableElement) Get a list of all currently registered Synchronizables.
GetAvatar Get locally spawned Avatar.
GetAvatar(String) Get Avatar by name.
GetAvatar(UInt16) Get Avatar by index.
GetAvatars Get all Users from current room.
GetComponentById(Guid) Get a Unity Component through its UID.
GetComponentById(IUniqueID) Get a Unity Component through its UID.
GetDebuggingInfo Get debugging info. Includes settings, device info, etc.
GetGameObjectById(Guid) Get a Unity GameObject through its UID.
GetGameObjectById(IUniqueID) Get a Unity GameObject through its UniqueID.
GetLastBlockResponse Get reason for connection block.
GetObjectByIdT(Guid) Get a object inheriting from IAdaptiveSerializableUniqueID through its UID.
GetObjectByIdT(IUniqueID) Get a object inheriting from IAdaptiveSerializableUniqueID through its UID.
GetSynchronizable Get a Synchronizable through its UniqueID.
GetUser Get your own User.
GetUser(Int32) Get User by index.
GetUser(String) Get User by name.
GetUser(UInt16) Get User by index.
GetUsers Get all Users from current room.
InvokeRemoteProcedure(String, UserId, ProcedureParameters, ISerializable, Reliability, RemoteProcedureReply, RemoteProcedureAck) Invoke a Remote Procedure Call (RPC).
InvokeRemoteProcedure(String, UInt16, ProcedureParameters, ISerializable, Reliability, RemoteProcedureReply, RemoteProcedureAck) Invoke a Remote Procedure Call (RPC).
IsRegistered(Guid) Check is specified UID registered.
IsRegistered(IUniqueID) Check is specified the UniqueID registered.
JoinFirstAvailable Join any available room. Only join rooms that is not full, does not have pin code, and is not invite only.
JoinMatchmaking Join a Room through matchmaking.
JoinMatchmaking(UInt16) Join a Room through matchmaking using a pin.
JoinOnDemandRoom Create and Join a Room. The Room will close when the last player leaves the room. Use CreateRoom for more control.
JoinOnDemandRoom(UInt32) Join Room by id. The Room will close when the last player leaves the room.
JoinRoom(Room) Join an available Room.
JoinRoom(Room, UInt16) Join an available Room using a pin.
JoinWithInviteCode Join a room using an invite code.
LoadScene(Int32, Boolean) Load a scene by index and move Multiplayer object and all Avatars to the new scene.
LoadScene(String, Boolean) Load a scene by name and move Multiplayer object and all Avatars to the new scene.
LockRoom Lock current room.
MakeUID 
MulticastRemoteProcedure Invoke a Remote Procedure Call (RPC) for multiple Users.
RefreshRoomList Refresh the AvailableRooms list containing the currently available Rooms on the server.
RegisterRemoteProcedure Register a Remote Procedure.
RegisterSynchronizable Register a Synchronizable to be synchronized through Alteruna Multiplayer.
ReplyRemoteProcedure Reply to a Remote Procedure Called by another User.
SendToBucket(Guid, Int32) Synchronize a specific UID to all Users within a specific bucket.
SendToBucket(CommunicationBridgeUID, Int32, Reliability) Synchronize a specific CommunicationBridgeUID to all Users within a specific bucket.
SendToBucket(IAdaptiveSerializableUniqueID, Int32, Reliability) Synchronize a specific object implementing IAdaptiveSerializableUniqueID to all Users within a specific bucket.
SendToBucket(IUniqueID, Int32, Reliability) Synchronize a specific object implementing IUniqueID to all Users within a specific bucket.
Serialize 
SetRoomName Rename currently joined room.
SetUsername Sets new username for non-connected user.
SoftReset Reset some internal fields regrading connection to their default values.
SpawnAvatar Spawn your avatar.
SpawnAvatar(Transform) Spawn Avatar at the position and oration of a transform.
SpawnAvatar(Vector3, Quaternion) Spawn Avatar using position and rotation.
SpawnAvatar(Vector3, Vector3) Spawn Avatar using position and rotation.
Sync(CommunicationBridgeUID, Reliability) Synchronize a specific Synchronizable through Alteruna Multiplayer.
Sync(Guid, Reliability) Synchronize a specific Synchronizable through Alteruna Multiplayer.
Sync(IAdaptiveSerializableUniqueID, Reliability) Synchronize a specific Synchronizable through Alteruna Multiplayer.
Sync(IUniqueID, Reliability) Synchronize a specific Synchronizable through Alteruna Multiplayer.
Sync(CommunicationBridgeUID, ListUInt16, Reliability) Synchronize a specific Synchronizable through Alteruna Multiplayer.
Sync(Guid, ListUInt16, Reliability) Synchronize a specific Synchronizable through Alteruna Multiplayer.
TryGetSynchronizable Get a Synchronizable through its UniqueID.
UnlockRoom Unlock current room.
Unserialize 

Fields

AvatarPrefab The prefab to spawn as an Avatar if SpawnAvatarOnJoin is true.
AvatarSpawning Avatar spawning behavior.
AvatarSpawnLocation The location at which to spawn Avatars.
AvatarSpawnLocations An indexed list of the locations at which to spawn Avatars.
Buckets A list containing all of the existing Buckets in the application.
LogLevel The lowest level of logs to print to the console.
NetworkPrefs Similar to Unity's PlayerPrefs, but stores data in the cloud. It is recommended to use its asynchronous methods.
OnConnected Event invoked after successfully connecting to a server.
OnDisconnected Event invoked after disconnecting from a server.
OnForceSync Called before data is synced for a force sync packet.
OnForceSynced On client request a force sync package.
OnForceSyncReply Invoked when received force sync data from other player.
OnJoinRejected Event invoked on join event rejected with a rejection reason.
OnLockAcquired Event invoked when successfully receives ownership for any object.
OnLockDenied Event invoked when an attempt to gain ownership over a object is denied.
OnLockRequested Event invoked on ownership requests.
OnLockUnlocked Event invoked when a object releases its ownership.
OnNetworkError Event invoked if any network related errors occur.
OnOtherUserJoined Event invoked when other User joined the Room. When joining a room, this event will be invoked for every User already in the Room.
OnOtherUserLeft Event invoked after another User left the Room.
OnPacketReceived Receive packet event.
OnPacketSent Send packet event.
OnRoomCreated Event invoked after successfully joining a Room.
OnRoomJoined Event invoked after successfully joining a Room.
OnRoomLeft Event invoked on successfully leaving a room.
OnRoomListUpdated Event invoked when the AvailableRooms list is modified.
OnRpcReceived On remote procedure call received. Multiplayer, name, sender
OnRpcRegistered On remote procedure call registered.
OnRpcSent On remote procedure call sent. Multiplayer, name, target, isMulticast
SpawnAvatarPerIndex Weather Avatars should be spawned in different locations based on their index in the Room.

See Also