Class CoherenceClientConnectionManager
public class CoherenceClientConnectionManager
- Inheritance
-
CoherenceClientConnectionManager
Properties
ClientConnectionCount
Returns the number of active client connections, including the local connection.
public int ClientConnectionCount { get; }
Property Value
Methods
Get(ClientID)
Returns a connection component associated with a given clientId
, or null if the connection was
not found. This is the same ClientID as in ClientId.
public CoherenceClientConnection Get(ClientID clientId)
Parameters
clientId
ClientID
Returns
Get(SerializeEntityID)
Returns a connection component associated with a given entityId
, or null if the connection was
not found.
public CoherenceClientConnection Get(SerializeEntityID entityId)
Parameters
entityId
SerializeEntityID
Returns
GetAll()
Returns a list of all client connections (both simulator and regular clients), including the local connection.
public IEnumerable<CoherenceClientConnection> GetAll()
Returns
GetAllClients()
Returns a list of all client connections (with no simulators), including the local connection.
public IEnumerable<CoherenceClientConnection> GetAllClients()
Returns
GetAllSimulators()
Returns a list of all simulator connections, including the local connection.
public IEnumerable<CoherenceClientConnection> GetAllSimulators()
Returns
GetMine()
Returns a connection associated with this client. May return null if the connection system is turned off or the connection object was not instantiated yet.
public CoherenceClientConnection GetMine()
Returns
GetOther()
Returns a list of all client connections (both simulator and regular clients) except for the local one.
public IEnumerable<CoherenceClientConnection> GetOther()
Returns
GetOtherClients()
Returns a list of all client connections except for the local one.
public IEnumerable<CoherenceClientConnection> GetOtherClients()
Returns
GetOtherSimulators()
Returns a list of all simulator connections except for the local one.
public IEnumerable<CoherenceClientConnection> GetOtherSimulators()
Returns
GetSimulator()
Returns a connection associated with the simulator. May return null if the connection system is turned off or the connection object for the simulator was not instantiated yet.
public CoherenceClientConnection GetSimulator()
Returns
SendMessage(Type, string, ClientID, MessageTarget, params object[])
Sends a client message to the connection whose ClientId matches the
clientId
.
public bool SendMessage(Type targetType, string methodName, ClientID clientId, MessageTarget target, params object[] args)
Parameters
targetType
TypemethodName
stringclientId
ClientIDtarget
MessageTargetargs
object[]
Returns
- bool
False if connection for a given
clientId
was not found, has no associated CoherenceSync, or if sending has failed.
SendMessage(Type, string, SerializeEntityID, MessageTarget, params object[])
Sends a client message to the connection whose EntityId matches the
entityId
.
public bool SendMessage(Type targetType, string methodName, SerializeEntityID entityId, MessageTarget target, params object[] args)
Parameters
targetType
TypemethodName
stringentityId
SerializeEntityIDtarget
MessageTargetargs
object[]
Returns
- bool
False if connection for a given
entityId
was not found, has no associated CoherenceSync, or if sending has failed.
SendMessageToAll(Type, string, MessageTarget, bool, params object[])
Sends a client message to every connection (both clients and simulators).
public bool SendMessageToAll(Type targetType, string methodName, MessageTarget target, bool sendToSelf, params object[] args)
Parameters
targetType
TypemethodName
stringtarget
MessageTargetsendToSelf
boolargs
object[]
Returns
- bool
False if sending has failed for any of the clients.
SendMessageToAllClients(Type, string, MessageTarget, bool, params object[])
Sends a client message to every client connection.
public bool SendMessageToAllClients(Type targetType, string methodName, MessageTarget target, bool sendToSelf, params object[] args)
Parameters
targetType
TypemethodName
stringtarget
MessageTargetsendToSelf
boolargs
object[]
Returns
- bool
False if sending has failed for any of the clients.
SendMessageToAllClients<TTarget>(string, MessageTarget, bool, params object[])
public bool SendMessageToAllClients<TTarget>(string methodName, MessageTarget target, bool sendToSelf, params object[] args) where TTarget : Component
Parameters
methodName
stringtarget
MessageTargetsendToSelf
boolargs
object[]
Returns
Type Parameters
TTarget
Type of the component that should receive this message.
SendMessageToAllSimulators(Type, string, MessageTarget, bool, params object[])
Sends a client message to every simulator connection.
public bool SendMessageToAllSimulators(Type targetType, string methodName, MessageTarget target, bool sendToSelf, params object[] args)
Parameters
targetType
TypemethodName
stringtarget
MessageTargetsendToSelf
boolargs
object[]
Returns
- bool
False if sending has failed for any of the clients.
SendMessageToAllSimulators<TTarget>(string, MessageTarget, bool, params object[])
public bool SendMessageToAllSimulators<TTarget>(string methodName, MessageTarget target, bool sendToSelf, params object[] args) where TTarget : Component
Parameters
methodName
stringtarget
MessageTargetsendToSelf
boolargs
object[]
Returns
Type Parameters
TTarget
Type of the component that should receive this message.
SendMessageToAll<TTarget>(string, MessageTarget, bool, params object[])
public bool SendMessageToAll<TTarget>(string methodName, MessageTarget target, bool sendToSelf, params object[] args) where TTarget : Component
Parameters
methodName
stringtarget
MessageTargetsendToSelf
boolargs
object[]
Returns
Type Parameters
TTarget
Type of the component that should receive this message.
SendMessage<TTarget>(string, ClientID, MessageTarget, params object[])
public bool SendMessage<TTarget>(string methodName, ClientID clientId, MessageTarget target, params object[] args) where TTarget : Component
Parameters
methodName
stringclientId
ClientIDtarget
MessageTargetargs
object[]
Returns
Type Parameters
TTarget
Type of the component that should receive this message.
SendMessage<TTarget>(string, SerializeEntityID, MessageTarget, params object[])
public bool SendMessage<TTarget>(string methodName, SerializeEntityID entityId, MessageTarget target, params object[] args) where TTarget : Component
Parameters
methodName
stringentityId
SerializeEntityIDtarget
MessageTargetargs
object[]
Returns
Type Parameters
TTarget
Type of the component that should receive this message.
Events
OnCreated
Called when a new CoherenceClientConnection is synced, including the local connection.
public event Action<CoherenceClientConnection> OnCreated
Event Type
OnDestroyed
Called when an existing CoherenceClientConnection is destroyed, including the local connection.
public event Action<CoherenceClientConnection> OnDestroyed
Event Type
OnSynced
Called when all connections present at the moment of joining the session get synced.
public event Action<CoherenceClientConnectionManager> OnSynced
Event Type
ProvidePrefab
Called before creating the CoherenceClientConnection. Allows for providing custom objects to be used as CoherenceClientConnection. Takes precedence over the ClientConnectionPrefab. If no provider was subscribed or provider returns null, the ClientConnectionPrefab is used.
public event ClientConnectionPrefabProvider ProvidePrefab