Class CoherenceSync
Represents a coherence entity. Add this component to a GameObject
and follow the instructions in the inspector to enable synchronization
of it and its variables, sending commands to it, parenting, LODing,
simulated inputs, and more.
See the coherence documentation for tutorials, guides, and more information.
[NonBindable]
public sealed class CoherenceSync : CoherenceBehaviour, ICoherenceSync, IConnectedEntityDriver
- Inheritance
-
CoherenceSync
- Implements
- Extension Methods
Constructors
CoherenceSync()
public CoherenceSync()
Fields
OnAuthTransferComplete
Called when the authority transfer or abandonment of this entity is completed.
public UnityEvent OnAuthTransferComplete
Field Value
OnAuthorityRequestRejected
Called if this client requested an authority transfer, but it was rejected.
public UnityEvent<AuthorityType> OnAuthorityRequestRejected
Field Value
- UnityEvent<AuthorityType>
OnConnectedEntityChanged
Called if the connected entity (transform.parent) for this entity changed on another client. This only happens when you don't have authority over this entity.
public UnityEvent<CoherenceSync> OnConnectedEntityChanged
Field Value
- UnityEvent<CoherenceSync>
OnInputAuthority
Called when this entity gains input authority.
public UnityEvent OnInputAuthority
Field Value
OnInputRemote
Called when this entity loses input authority. This can happen if another entity successfully requests/steals authority over the entity.
public UnityEvent OnInputRemote
Field Value
OnInputSimulatorConnected
public UnityEvent OnInputSimulatorConnected
Field Value
OnRigidbody2DPositionUpdate
Called if RigidbodyUpdateMode is set to `Manual' when the rigidbody2D position would be updated.
public UnityEvent<Vector2> OnRigidbody2DPositionUpdate
Field Value
- UnityEvent<Vector2>
OnRigidbody2DRotationUpdate
Called if RigidbodyUpdateMode is set to `Manual' when the rigidbody2D rotation would be updated.
public UnityEvent<float> OnRigidbody2DRotationUpdate
Field Value
- UnityEvent<float>
OnRigidbody3DPositionUpdate
Called if RigidbodyUpdateMode is set to `Manual' when the rigidbody3D position would be updated.
public UnityEvent<Vector3> OnRigidbody3DPositionUpdate
Field Value
- UnityEvent<Vector3>
OnRigidbody3DRotationUpdate
Called if RigidbodyUpdateMode is set to `Manual' when the rigidbody3D rotation would be updated.
public UnityEvent<Quaternion> OnRigidbody3DRotationUpdate
Field Value
- UnityEvent<Quaternion>
OnStateAuthority
Called when this entity gains state authority. This can happen after requesting authority manually, or if the entity was an orphan set to AutoAdopt.
public UnityEvent OnStateAuthority
Field Value
OnStateRemote
Called when this entity loses state authority. This can happen if another entity successfully requests/steals authority over the entity.
public UnityEvent OnStateRemote
Field Value
RigidbodyUpdateMode
Determines how the properties of an attached rigidbody are updated.
public CoherenceSync.RigidbodyMode RigidbodyUpdateMode
Field Value
Remarks
If there is an attached rigidbody, and the mode is Interpolated
,
then the CoherenceSync.InterpolationLocation must be set to only FixedUpdate
or there will be inconsistencies in the state of the rigidbody and the values of the
angular and linear velocity are lost.
approveAuthorityTransferRequests
This is a fallback value exposed in the CoherenceSync inspector. It is only used if the simulationType is set to Request and there's no event listener set for OnAuthorityRequestedByConnection.
public bool approveAuthorityTransferRequests
Field Value
authorityTransferType
How this entity should respond to requests for authority (via RequestAuthority(AuthorityType)) by other clients.
public CoherenceSync.AuthorityTransferType authorityTransferType
Field Value
bindings
public List<Binding> bindings
Field Value
coherenceTag
A user-defined string that can be used by CoherenceTagQuery.
[CoherenceTag]
public string coherenceTag
Field Value
floatingOriginMode
public CoherenceSync.FloatingOriginMode floatingOriginMode
Field Value
floatingOriginParentedMode
public CoherenceSync.FloatingOriginMode floatingOriginParentedMode
Field Value
lifetimeType
What should happen to this entity after the client with authority over it disconnects or abandons it.
public CoherenceSync.LifetimeType lifetimeType
Field Value
orphanedBehavior
How this entity should behave if it is abandoned by its client, e.g. if it disconnects and the entity is set to Persistent.
public CoherenceSync.OrphanedBehavior orphanedBehavior
Field Value
simulationType
How and where this entity is simulated.
public CoherenceSync.SimulationType simulationType
Field Value
uniquenessType
Should this entity enforce that only a single instance with the same Toolkit.CoherenceUUID can exist at the same time.
public CoherenceSync.UniquenessType uniquenessType
Field Value
Properties
Archetype
Contains all information related to LODing, which can be set up in the 'Optimize' window of the CoherenceSync inspector.
This property is set to null if the entity isn't using LODs.
public ToolkitArchetype Archetype { get; }
Property Value
ArchetypeName
public string ArchetypeName { get; }
Property Value
AuthorityTransferTypeConfig
public CoherenceSync.AuthorityTransferType AuthorityTransferTypeConfig { get; }
Property Value
BakedScript
public CoherenceSyncBaked BakedScript { get; }
Property Value
Bindings
public List<Binding> Bindings { get; }
Property Value
CoherenceBridge
The CoherenceBridge that this entity is connecting through.
public CoherenceBridge CoherenceBridge { get; }
Property Value
CoherenceSyncConfig
public CoherenceSyncConfig CoherenceSyncConfig { get; }
Property Value
CoherenceTag
public string CoherenceTag { get; set; }
Property Value
ConnectedEntity
The closest parent entity (with CoherenceSync
) above this entity
in the transform hierarchy.
Please note that this is not always the direct parent of this entity's transform, e.g. when using CoherenceNode.
public CoherenceSync ConnectedEntity { get; }
Property Value
EntityState
A local id used to identify the entity on the current client. This id is not synced across clients.
If you need to sync or send an entity reference to another client,
use a coherence 'entity reference' instead (this can be a CoherenceSync
,
GameObject
or a UnityEngine.Transform
.)
public NetworkEntityState EntityState { get; }
Property Value
HasInput
True if the entity has a CoherenceInput component.
public bool HasInput { get; }
Property Value
HasInputAuthority
True if your client has input authority over the entity. Input authority can produce inputs via CoherenceInput which are then sent to the state authority who processes them.
public bool HasInputAuthority { get; }
Property Value
HasNodePathChanged
public bool HasNodePathChanged { get; set; }
Property Value
HasParentWithCoherenceSync
public bool HasParentWithCoherenceSync { get; }
Property Value
HasStateAuthority
True if your client has state authority over the entity. State authority is an actual owner of the entity and controls all the synced variables.
public bool HasStateAuthority { get; }
Property Value
Input
Retrieve the CoherenceInput component on this entity, if it has one.
public CoherenceInput Input { get; }
Property Value
InterpolationLocationConfig
Determines the loop in which the interpolation will be performed.
public CoherenceSync.InterpolationLoop InterpolationLocationConfig { get; set; }
Property Value
Remarks
If there is an attached rigidbody, the FixedUpdate
loop will always be used in addition to other loops
from this setting.
IsPersistent
True if the lifetime is Persistent.
public bool IsPersistent { get; }
Property Value
IsSynchronizedWithNetwork
True if this CoherenceSync instance is currently being synchronized over the network. False otherwise.
public bool IsSynchronizedWithNetwork { get; }
Property Value
IsUnique
public bool IsUnique { get; }
Property Value
LifetimeTypeConfig
public CoherenceSync.LifetimeType LifetimeTypeConfig { get; }
Property Value
ManualUniqueId
A unique identifier used to ensure that CoherenceSync prefabs with uniquenessType set to NoDuplicates only have a single instance across all clients, if not set, the UUID will be autogenerated.
You cannot change an instance UUID at runtime. If you wish to use runtime-generated UUIDs, please register them through CoherenceBridge.UniquenessManager.RegisterUniqueId instead.
public string ManualUniqueId { get; }
Property Value
OnFloatingOriginShifted
public Action<Vector3, Vector3> OnFloatingOriginShifted { get; set; }
Property Value
- Action<Vector3, Vector3>
OrphanedBehaviorConfig
public CoherenceSync.OrphanedBehavior OrphanedBehaviorConfig { get; }
Property Value
PreserveChildren
public bool PreserveChildren { get; }
Property Value
ReplacementStrategy
public CoherenceSync.UniqueObjectReplacementStrategy ReplacementStrategy { get; }
Property Value
SimulationTypeConfig
public CoherenceSync.SimulationType SimulationTypeConfig { get; }
Property Value
UnsyncedEntityPriority
public CoherenceSync.UnsyncedNetworkEntityPriority UnsyncedEntityPriority { get; }
Property Value
Updater
public ICoherenceSyncUpdater Updater { get; }
Property Value
UseReflection
public bool UseReflection { get; }
Property Value
UsesLODsAtRuntime
True if the entity will use LODs at runtime.
An entity with LODs still won't use it if it's set to use usingReflection.
public bool UsesLODsAtRuntime { get; }
Property Value
logger
public Logger logger { get; }
Property Value
Methods
AbandonAuthority()
Transfers ownership of the game object to the replication server, making it an orphan. The game object must be persistent, transferable and simulated by this client. The transfer fails if isSimulated is false, lifetimeType is SessionBased or authorityTransferType is NotTransferable.
public bool AbandonAuthority()
Returns
- bool
true if the authority transfer was successful, or false if it failed.
Adopt()
Requests authority over an orphaned entity. Works only if isOrphaned is 'true'.
public bool Adopt()
Returns
- bool
true if calling this method succeeded. (The authority request itself can still fail.)
ApplyNodeBindings()
public void ApplyNodeBindings()
DestroyAsDuplicate()
public void DestroyAsDuplicate()
GetBakedValueBinding<T>(string)
Returns the binding with matching type and name or null if no match exist. If no name is supplied, the first binding with matching type is returned. If multiple matches exist, the first binding in the Bindings list is returned.
public T GetBakedValueBinding<T>(string bindingName = null) where T : Binding
Parameters
bindingName
stringThe name of the binding, e.g. "position" (optional)
Returns
- T
A binding matching the given type and name
Type Parameters
T
The type of binding, e.g., Coherence.Toolkit.CoherenceSync.PositionBinding
HandleDisconnected()
public void HandleDisconnected()
HandleNetworkedDestruction(bool)
public void HandleNetworkedDestruction(bool destroyedByParent)
Parameters
destroyedByParent
bool
InitializeReplacedUniqueObject(SpawnInfo)
public void InitializeReplacedUniqueObject(SpawnInfo info)
Parameters
info
SpawnInfo
IsChildFromSyncGroup()
public bool IsChildFromSyncGroup()
Returns
OnNetworkCommandReceived(object, byte[])
public void OnNetworkCommandReceived(object sender, byte[] data)
Parameters
RaiseOnAuthorityRequested(ClientID, AuthorityType)
public bool RaiseOnAuthorityRequested(ClientID requesterID, AuthorityType authorityType)
Parameters
requesterID
ClientIDauthorityType
AuthorityType
Returns
RaiseOnConnectedEntityChanged()
For internal use only.
public void RaiseOnConnectedEntityChanged()
ReceiveCommand(IEntityCommand, MessageTarget)
public void ReceiveCommand(IEntityCommand command, MessageTarget target)
Parameters
command
IEntityCommandtarget
MessageTarget
RequestAuthority(AuthorityType)
Try to get authority over this entity. Listen to the events OnAuthorityGained and OnAuthorityTransferRejected to get notified whether the request succeeded or not.
public bool RequestAuthority(AuthorityType authorityType)
Parameters
authorityType
AuthorityType
Returns
- bool
true if calling this method succeeded. (The authority request itself can still fail.)
Reset()
protected override void Reset()
ResetInterpolation(bool)
Clear all state of the interpolation used on the synced variables and properties of this entity.
This is useful when the existing interpolation would interfere with the position and movement of the entity, e.g. after teleporting it to a completely new location.
Optional parameter to set the value of the binding to the latest sampled value.
public void ResetInterpolation(bool setToLastSamples = false)
Parameters
setToLastSamples
bool
SendCommand(Action, MessageTarget)
Send a command to another client to call a method in a specific component, if you have more than one component method bound in the same hierarchy.
public bool SendCommand(Action action, MessageTarget target)
Parameters
action
ActionAction instance of the component and method command that you wish to send
target
MessageTargetTo which clients should this command be sent.
Returns
- bool
true if the sending was successful.
SendCommand(Type, string, MessageTarget)
Send a command to another client to call a method on one of its components.
public bool SendCommand(Type targetType, string methodName, MessageTarget target)
Parameters
targetType
TypeThe type of the Unity component that contains the method to call.
methodName
stringThe name of the method to call. Tip: use C#'s nameof() operator to avoid name mismatches.
target
MessageTargetTo which clients should this command be sent.
Returns
- bool
true if the sending was successful.
SendCommand(Type, string, MessageTarget, params object[])
Send a command to another client to call a method on one of its components.
public bool SendCommand(Type targetType, string methodName, MessageTarget target, params object[] args)
Parameters
targetType
TypeThe type of the Unity component that contains the method to call.
methodName
stringThe name of the method to call. Tip: use C#'s nameof() operator to avoid name mismatches.
target
MessageTargetTo which clients should this command be sent.
args
object[]The arguments to send to the method, make sure they match its signature.
Returns
- bool
true if the sending was successful.
SendCommand(Type, string, MessageTarget, params (Type, object)[])
Send a command to another client to call a method on one of its components.
public bool SendCommand(Type targetType, string methodName, MessageTarget target, params (Type, object)[] args)
Parameters
targetType
TypeThe type of the Unity component that contains the method to call.
methodName
stringThe name of the method to call. Tip: use C#'s nameof() operator to avoid name mismatches.
target
MessageTargetTo which clients should this command be sent.
args
(Type, object)[]The arguments to send to the method, make sure they match its signature. This version of SendCommand uses tuples with the type and the value of each argument, this enables sending of null values.
Returns
- bool
true if the sending was successful.
SendCommandToChildren(Type, string, MessageTarget)
Send a command to another client to call a method to every component in the hierarchy that has methodName bound.
public bool SendCommandToChildren(Type targetType, string methodName, MessageTarget target)
Parameters
targetType
TypeThe type of the Unity component that contains the method to call.
methodName
stringThe name of the method to call. Tip: use C#'s nameof() operator to avoid name mismatches.
target
MessageTargetTo which clients should this command be sent.
Returns
- bool
true if the sending was successful.
SendCommandToChildren(Type, string, MessageTarget, params object[])
Send a command to another client to call a method to every component in the hierarchy that has methodName bound.
public bool SendCommandToChildren(Type targetType, string methodName, MessageTarget target, params object[] args)
Parameters
targetType
TypeThe type of the Unity component that contains the method to call.
methodName
stringThe name of the method to call. Tip: use C#'s nameof() operator to avoid name mismatches.
target
MessageTargetTo which clients should this command be sent.
args
object[]The arguments to send to the method, make sure they match its signature.
Returns
- bool
true if the sending was successful.
SendCommandToChildren(Type, string, MessageTarget, params (Type, object)[])
Send a command to another client to call a method to every component in the hierarchy that has methodName bound.
public bool SendCommandToChildren(Type targetType, string methodName, MessageTarget target, params (Type, object)[] args)
Parameters
targetType
TypeThe type of the Unity component that contains the method to call.
methodName
stringThe name of the method to call. Tip: use C#'s nameof() operator to avoid name mismatches.
target
MessageTargetTo which clients should this command be sent.
args
(Type, object)[]The arguments to send to the method, make sure they match its signature. This version of SendCommand uses tuples with the type and the value of each argument, this enables sending of null values.
Returns
- bool
true if the sending was successful.
SendCommandToChildren<TTarget>(string, MessageTarget)
Send a command to another client to call a method to every component in the hierarchy that has methodName bound.
public bool SendCommandToChildren<TTarget>(string methodName, MessageTarget target) where TTarget : Component
Parameters
methodName
stringThe name of the method to call. Tip: use C#'s nameof() operator to avoid name mismatches.
target
MessageTargetTo which clients should this command be sent.
Returns
- bool
true if the sending was successful.
Type Parameters
TTarget
The type of the Unity component that contains the method to call.
SendCommandToChildren<TTarget>(string, MessageTarget, params object[])
Send a command to another client to call a method to every component in the hierarchy that has methodName bound.
public bool SendCommandToChildren<TTarget>(string methodName, MessageTarget target, params object[] args) where TTarget : Component
Parameters
methodName
stringThe name of the method to call. Tip: use C#'s nameof() operator to avoid name mismatches.
target
MessageTargetTo which clients should this command be sent.
args
object[]The arguments to send to the method, make sure they match its signature.
Returns
- bool
true if the sending was successful.
Type Parameters
TTarget
The type of the Unity component that contains the method to call.
SendCommandToChildren<TTarget>(string, MessageTarget, params (Type, object)[])
Send a command to another client to call a method to every component in the hierarchy that has methodName bound.
public bool SendCommandToChildren<TTarget>(string methodName, MessageTarget target, params (Type, object)[] args) where TTarget : Component
Parameters
methodName
stringThe name of the method to call. Tip: use C#'s nameof() operator to avoid name mismatches.
target
MessageTargetTo which clients should this command be sent.
args
(Type, object)[]The arguments to send to the method, make sure they match its signature. This version of SendCommand uses tuples with the type and the value of each argument, this enables sending of null values.
Returns
- bool
true if the sending was successful.
Type Parameters
TTarget
The type of the Unity component that contains the method to call.
SendCommand<T>(Action<T>, MessageTarget, T)
Send a command to another client to call a method in a specific component, if you have more than one component method bound in the same hierarchy.
public bool SendCommand<T>(Action<T> action, MessageTarget target, T param1)
Parameters
action
Action<T>Action instance of the component and method command that you wish to send
target
MessageTargetTo which clients should this command be sent.
param1
TArgument of type T to send to the method
Returns
- bool
true if the sending was successful.
Type Parameters
T
SendCommand<TTarget>(string, MessageTarget)
Send a command to another client to call a method on one of its components.
public bool SendCommand<TTarget>(string methodName, MessageTarget target) where TTarget : Component
Parameters
methodName
stringThe name of the method to call. Tip: use C#'s nameof() operator to avoid name mismatches.
target
MessageTargetTo which clients should this command be sent.
Returns
- bool
true if the sending was successful.
Type Parameters
TTarget
The type of the Unity component that contains the method to call.
SendCommand<TTarget>(string, MessageTarget, params object[])
Send a command to another client to call a method on one of its components.
public bool SendCommand<TTarget>(string methodName, MessageTarget target, params object[] args) where TTarget : Component
Parameters
methodName
stringThe name of the method to call. Tip: use C#'s nameof() operator to avoid name mismatches.
target
MessageTargetTo which clients should this command be sent.
args
object[]The arguments to send to the method, make sure they match its signature.
Returns
- bool
true if the sending was successful.
Type Parameters
TTarget
The type of the Unity component that contains the method to call.
SendCommand<TTarget>(string, MessageTarget, params (Type, object)[])
Send a command to another client to call a method on one of its components.
public bool SendCommand<TTarget>(string methodName, MessageTarget target, params (Type, object)[] args) where TTarget : Component
Parameters
methodName
stringThe name of the method to call. Tip: use C#'s nameof() operator to avoid name mismatches.
target
MessageTargetTo which clients should this command be sent.
args
(Type, object)[]The arguments to send to the method, make sure they match its signature. This version of SendCommand uses tuples with the type and the value of each argument, this enables sending of null values.
Returns
- bool
true if the sending was successful.
Type Parameters
TTarget
The type of the Unity component that contains the method to call.
SendCommand<T1, T2>(Action<T1, T2>, MessageTarget, T1, T2)
Send a command to another client to call a method in a specific component, if you have more than one component method bound in the same hierarchy.
public bool SendCommand<T1, T2>(Action<T1, T2> action, MessageTarget target, T1 param1, T2 param2)
Parameters
action
Action<T1, T2>Action instance of the component and method command that you wish to send
target
MessageTargetTo which clients should this command be sent.
param1
T1Argument of type T1 to send to the method
param2
T2Argument of type T2 to send to the method
Returns
- bool
true if the sending was successful.
Type Parameters
T1
T2
SendCommand<T1, T2, T3>(Action<T1, T2, T3>, MessageTarget, T1, T2, T3)
Send a command to another client to call a method in a specific component, if you have more than one component method bound in the same hierarchy.
public bool SendCommand<T1, T2, T3>(Action<T1, T2, T3> action, MessageTarget target, T1 param1, T2 param2, T3 param3)
Parameters
action
Action<T1, T2, T3>Action instance of the component and method command that you wish to send
target
MessageTargetTo which clients should this command be sent.
param1
T1Argument of type T1 to send to the method
param2
T2Argument of type T2 to send to the method
param3
T3Argument of type T3 to send to the method
Returns
- bool
true if the sending was successful.
Type Parameters
T1
T2
T3
SendCommand<T1, T2, T3, T4>(Action<T1, T2, T3, T4>, MessageTarget, T1, T2, T3, T4)
Send a command to another client to call a method in a specific component, if you have more than one component method bound in the same hierarchy.
public bool SendCommand<T1, T2, T3, T4>(Action<T1, T2, T3, T4> action, MessageTarget target, T1 param1, T2 param2, T3 param3, T4 param4)
Parameters
action
Action<T1, T2, T3, T4>Action instance of the component and method command that you wish to send
target
MessageTargetTo which clients should this command be sent.
param1
T1Argument of type T1 to send to the method
param2
T2Argument of type T2 to send to the method
param3
T3Argument of type T3 to send to the method
param4
T4Argument of type T4 to send to the method
Returns
- bool
true if the sending was successful.
Type Parameters
T1
T2
T3
T4
SendCommand<T1, T2, T3, T4, T5>(Action<T1, T2, T3, T4, T5>, MessageTarget, T1, T2, T3, T4, T5)
Send a command to another client to call a method in a specific component, if you have more than one component method bound in the same hierarchy.
public bool SendCommand<T1, T2, T3, T4, T5>(Action<T1, T2, T3, T4, T5> action, MessageTarget target, T1 param1, T2 param2, T3 param3, T4 param4, T5 param5)
Parameters
action
Action<T1, T2, T3, T4, T5>Action instance of the component and method command that you wish to send
target
MessageTargetTo which clients should this command be sent.
param1
T1Argument of type T1 to send to the method
param2
T2Argument of type T2 to send to the method
param3
T3Argument of type T3 to send to the method
param4
T4Argument of type T4 to send to the method
param5
T5Argument of type T5 to send to the method
Returns
- bool
true if the sending was successful.
Type Parameters
T1
T2
T3
T4
T5
SendCommand<T1, T2, T3, T4, T5, T6>(Action<T1, T2, T3, T4, T5, T6>, MessageTarget, T1, T2, T3, T4, T5, T6)
Send a command to another client to call a method in a specific component, if you have more than one component method bound in the same hierarchy.
public bool SendCommand<T1, T2, T3, T4, T5, T6>(Action<T1, T2, T3, T4, T5, T6> action, MessageTarget target, T1 param1, T2 param2, T3 param3, T4 param4, T5 param5, T6 param6)
Parameters
action
Action<T1, T2, T3, T4, T5, T6>Action instance of the component and method command that you wish to send
target
MessageTargetTo which clients should this command be sent.
param1
T1Argument of type T1 to send to the method
param2
T2Argument of type T2 to send to the method
param3
T3Argument of type T3 to send to the method
param4
T4Argument of type T4 to send to the method
param5
T5Argument of type T5 to send to the method
param6
T6Argument of type T6 to send to the method
Returns
- bool
true if the sending was successful.
Type Parameters
T1
T2
T3
T4
T5
T6
SendCommand<T1, T2, T3, T4, T5, T6, T7>(Action<T1, T2, T3, T4, T5, T6, T7>, MessageTarget, T1, T2, T3, T4, T5, T6, T7)
Send a command to another client to call a method in a specific component, if you have more than one component method bound in the same hierarchy.
public bool SendCommand<T1, T2, T3, T4, T5, T6, T7>(Action<T1, T2, T3, T4, T5, T6, T7> action, MessageTarget target, T1 param1, T2 param2, T3 param3, T4 param4, T5 param5, T6 param6, T7 param7)
Parameters
action
Action<T1, T2, T3, T4, T5, T6, T7>Action instance of the component and method command that you wish to send
target
MessageTargetTo which clients should this command be sent.
param1
T1Argument of type T1 to send to the method
param2
T2Argument of type T2 to send to the method
param3
T3Argument of type T3 to send to the method
param4
T4Argument of type T4 to send to the method
param5
T5Argument of type T5 to send to the method
param6
T6Argument of type T6 to send to the method
param7
T7Argument of type T7 to send to the method
Returns
- bool
true if the sending was successful.
Type Parameters
T1
T2
T3
T4
T5
T6
T7
SendCommand<T1, T2, T3, T4, T5, T6, T7, T8>(Action<T1, T2, T3, T4, T5, T6, T7, T8>, MessageTarget, T1, T2, T3, T4, T5, T6, T7, T8)
Send a command to another client to call a method in a specific component, if you have more than one component method bound in the same hierarchy.
public bool SendCommand<T1, T2, T3, T4, T5, T6, T7, T8>(Action<T1, T2, T3, T4, T5, T6, T7, T8> action, MessageTarget target, T1 param1, T2 param2, T3 param3, T4 param4, T5 param5, T6 param6, T7 param7, T8 param8)
Parameters
action
Action<T1, T2, T3, T4, T5, T6, T7, T8>Action instance of the component and method command that you wish to send
target
MessageTargetTo which clients should this command be sent.
param1
T1Argument of type T1 to send to the method
param2
T2Argument of type T2 to send to the method
param3
T3Argument of type T3 to send to the method
param4
T4Argument of type T4 to send to the method
param5
T5Argument of type T5 to send to the method
param6
T6Argument of type T6 to send to the method
param7
T7Argument of type T7 to send to the method
param8
T8Argument of type T8 to send to the method
Returns
- bool
true if the sending was successful.
Type Parameters
T1
T2
T3
T4
T5
T6
T7
T8
SendConnectedEntity()
public void SendConnectedEntity()
SetObservedLodLevel(int)
public void SetObservedLodLevel(int lod)
Parameters
lod
int
TransferAuthority(ClientID, AuthorityType)
Give away authority over this entity to another client. Requires that this client currently has authority.
public bool TransferAuthority(ClientID clientID, AuthorityType authorityTransferred = AuthorityType.Full)
Parameters
clientID
ClientIDClientID of the client that should get authority over this entity. ClientID can be retrieved from the ClientConnections.
authorityTransferred
AuthorityTypeType of authority transferred.
Returns
- bool
True if calling this method succeeded. (The authority request itself can still fail.)
TryGetBinding(Type, string, out Binding)
Get the first binding on the component of a specific type.
public bool TryGetBinding(Type componentType, string name, out Binding returnBinding)
Parameters
Returns
TryGetBindingByGuid(string, out Binding)
public bool TryGetBindingByGuid(string bindingGuid, out Binding outBinding)
Parameters
Returns
ValidateConnectedEntity()
public void ValidateConnectedEntity()
Events
BridgeResolve
public static event CoherenceBridgeResolver<CoherenceSync> BridgeResolve
Event Type
ConnectedEntityChangeOverride
Listening to this event overrides the default parenting behaviour, which just parents this object to any new connected entity.
It can be used to implement more advanced hierarchies than direct parent-to-child relationships. See CoherenceNode.
public event CoherenceSync.ConnectedEntityChangeHandler ConnectedEntityChangeOverride
Event Type
DidSendConnectedEntity
This event is called after the entity has changed its parent and sent this update to other clients.
Listening to this event doesn't change any behaviour, but can be useful for reacting to changes in the connected entity for a simulated entity.
public event CoherenceSync.ConnectedEntitySentHandler DidSendConnectedEntity
Event Type
OnAuthorityRequested
Raised when other client requests an authority over this entity and the authorityTransferType is set to Request.
public event CoherenceSync.OnAuthorityRequestedHandler OnAuthorityRequested