public class MultiplayerManager : MonoBehaviour,
IAdaptiveSerializableUniqueID, IAdaptiveSerializable, IUniqueID
public class MyClass : CommunicationBridge
{
public ushort[] GetUserIDs()
{
return
// Get all users in the current room
Multiplayer.GetUsers()
// Select user Index
.Select(u => u.Index)
// return as an array
.ToArray();
}
}public class MyClass : CommunicationBridge
{
private readonly RoomArgs _roomSettings = new RoomArgs
{
// At most four players can be in this room at once.
MaxUsers = 4,
// The user joins the room upon creation.
JoinRoom = true,
};
public void CreatePrivateRoom()
{
Multiplayer.CreatePrivateRoom(_roomSettings);
}
}| ApplicationData | |
| 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. |
| IsAuthenticated | |
| IsConnected | Whether currently connected to a server. |
| IsConnecting | Whether currently connecting to a server. |
| IsHost | |
| Latency | Connection latency. When no connection is established, last connection will be returned. |
| 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. |
| Started | True when the manager is ready to connect. |
| State | |
| UID | |
| UIDString | Get the unique identifier of the Alteruna Multiplayer instance as a string. |
| Connect | Connect to the Alteruna service manually when the config ConnectOnStart is disabled. |
| CreatePrivateRoom(RoomArgs) | Create a new private room. |
| CreatePrivateRoom(String, UInt16, Boolean, Boolean) | Create a new private room. Obsolete. |
| CreateRoom | Create room. |
| CreateRoom(RoomArgs) | Create room. |
| CreateRoom(String, Boolean, UInt16, Boolean, Boolean, UInt16) | Create a new room. Obsolete. |
| DeregisterCodec | Deregister a Synchronizable from Alteruna Multiplayer, so that it is no longer being synchronized. |
| DirectConnect(String) | Connect using ip. If no port is specified, it will use the default port. |
| DirectConnect(String, UInt16) | Connect using ip and port. |
| Disconnect | Disconnect from the Alteruna Multiplayer service and reset the local state. |
| 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 an object inheriting from IAdaptiveSerializableUniqueID through its UID. |
| GetObjectByIdT(IUniqueID) | Get an object inheriting from IAdaptiveSerializableUniqueID through its UID. |
| GetSynchronizable(Guid) | Get a Synchronizable through its UniqueID. |
| GetSynchronizable(IUniqueID) | 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. |
| Host | Host a local server. |
| 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. |
| JoinLan | Join a LAN server. |
| JoinLan(UInt16) | Join a LAN server on a specific port. |
| 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. Obsolete. |
| 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 the 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. |
| StartRemoteServer | |
| 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(Guid, IAdaptiveSerializable) | Get a Synchronizable through its UniqueID. |
| TryGetSynchronizable(IUniqueID, IAdaptiveSerializable) | Get a Synchronizable through its UniqueID. |
| UnlockRoom | Unlock current room. |
| Unserialize |
| 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 the existing Buckets in the application. |
| ConnectOnStart | Determines whether the multiplayer session will attempt to establish a connection automatically when the application starts. |
| LogLevel | The lowest level of logs to print to the console. |
| 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 an object is denied. |
| OnLockRequested | Event invoked on ownership requests. |
| OnLockUnlocked | Event invoked when an 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 |
| OnStarted | Event invoked after Alteruna services started. |
| SpawnAvatarPerIndex | Weather Avatars should be spawned in different locations based on their index in the Room. |