CoherenceBridge
Component used to establish and maintain a connection with the replication server.
Remarks
It is responsible for keeping the CoherenceSync entities in sync.
To get references to CoherenceBridge instances, refer to CoherenceBridgeStore.
Fields
ClientConnectionEntry | The CoherenceSyncConfig to instantiate when this bridge establishes a Client connection. |
SimulatorConnectionEntry | The CoherenceSyncConfig to instantiate when this bridge establishes a Simulator connection. |
adjustSimulationFrameByPing | Accounts for the time required for the packets to travel between the server and the client when calculating the client-server frame drift. |
controlTimeScale | Enables automatic client-server synchronization. |
onConnected | Invoked when the bridge has successfully connected. |
onConnectionError | Called when the bridge experiences a connection error. |
onDisconnected | Called when the bridge has disconnected. |
onLiveQuerySynced | Called when all entities that originated from a CoherenceLiveQuery have been synced. |
onNetworkEntityCreated | Called when a network entity has been created. |
onNetworkEntityDestroyed | Called when a network entity has been destroyed. |
Properties
AuthorityManager | Handles authority requests over entities and adoptions of orphaned entities. |
AutoLoginAsGuest | Set to true to authenticate as a guest. |
Client | Reference to the lower-level client that handles the connection. |
ClientConnections | Holds information about all CoherenceClientConnections in this session. |
ClientFixedSimulationFrame | Similar to ClientSimulationFrame but quantized to FixedTimeStep. |
ClientID | Unique ID of this connection as assigned by the server. |
CloudService | Service to communicate with the coherence Cloud. |
ConnectionType | The connection type that was used when connecting to the replication server. |
EnableClientConnections | Allows for client connection entities to be created. |
EntitiesManager | Holds information about all entities that are visible to this connection. |
EntityCount | Number of entities visible by this bridge. |
FloatingOriginManager | Manipulates the Floating Origin. |
GlobalQueryGameObject | Reference to the global query entity. |
InputManager | Handles client entities with server-side input. |
InstantiationScene | Scene where this Bridge will instantiate remote entities. |
IsConnected | Whether the bridge has established a connection. |
IsConnecting | Whether the bridge is establishing a connection. |
IsMain | Determines if this bridge is the main one. |
IsSimulatorOrHost | When true, this client is considered a host of this session. |
NetStats | Stats related to inbound and outbound data through the connection. |
NetworkPrefix | Prefix prepended to the name of CoherenceSync entities spawned through the network. |
NetworkTime | Provides access to the network synchronized time and frame state. |
NetworkTimeAsDouble | Network time in double precision. |
OnAfterFloatingOriginShifted | Invoked after OnFloatingOriginShifted |
OnFloatingOriginShifted | Invoked at the end of the floating point origin shifting operation started via SetFloatingOrigin(Vector3d) or TranslateFloatingOrigin(Vector3d), after all objects have been shifted.. |
Ping | Latency related information. |
Scene | Reference to the scene where this bridge is. |
SceneManager | Controls what scene this client should receive and send updates for. |
Transform | The transform of this entity. |
UniquenessManager | Holds information about all unique entities in this session. |
WorldPositionMaxRange | Maximum abs position of an entity/liveQuery/floatingOrigin |
Methods
Connect | Attempts a connection to the replication server. |
ConnectAsHost | Attempts to connect as a host-client. |
Disconnect | Disconnects from the replication server. |
DontDestroyOnLoad | Convenience method for tagging this bridge as DontDestroyOnLoad(). |
EntityIdToCoherenceSync | Get the CoherenceSync for an Entity. |
EntityIdToGameObject | Get the UnityEngine.GameObject for an Entity. |
EntityIdToRectTransform | Get the RectTransform for an Entity. |
EntityIdToTransform | |
GetClientConnectionEntry | The CoherenceSyncConfig to instantiate when this bridge establishes a Client connection. |
GetCoherenceSyncForEntity | Get an entity known by this bridge. |
GetFloatingOrigin | Returns the current absolute position of the floating point origin. |
GetNetworkEntityStateForEntity | Get the state of an entity known by this bridge. |
GetSimulatorConnectionEntry | The CoherenceSyncConfig to instantiate when this bridge establishes a Simulator connection. |
JoinRoom | Attempts to join a room. |
JoinWorld | Attempts to connect to a world. |
Reconnect | Attempts to reconnect to the replication server. |
SetFloatingOrigin | Sets the floating point origin absolute position to a new value. Only works if bridge isConnected, otherwise nothing happens. |
SetInitialScene | Set the initial scene to connect to. |
SetRelay | Sets a IRelay to be managed. |
SetTransportFactory | Sets the transport factory used when connecting to the replication server. |
SetTransportType | Sets the type of the transport which will be used when connecting to the replication server. |
TranslateFloatingOrigin | Moves the floating point origin by a |
UnityObjectToEntityId | Get the Entity for a CoherenceSync. |
Events
OnFixedNetworkUpdate | With MultiClientMode enabled it is recommended to put simulation code in OnFixedNetworkUpdate event handlers instead of FixedUpdate. This allows multiple connected clients within the application to execute at different frequencies for correct network synchronization. The Time.fixedDeltaTime should be applied similar to how it is normally used in FixedUpdate. |
OnLateFixedNetworkUpdate | Similar to OnFixedNetworkUpdate but guaranteed to be called later. |
OnTimeReset | Triggered the first time SetServerSimulationFrame(AbsoluteSimulationFrame, Ping) is called and at any subsequent call if ClientSimulationFrame and ServerSimulationFrame have drifter too far apart. |