Table of Contents

Class CoherenceSync

Namespace
Coherence.Toolkit
Assembly
Coherence.Toolkit.dll

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, IObserver<AuthorityType>
Inheritance
CoherenceSync
Implements
Extension Methods

Constructors

CoherenceSync()

public CoherenceSync()

Fields

InterpolationLocation

Determines the loop in which the interpolation will be performed.

public CoherenceSync.InterpolationLoop InterpolationLocation

Field Value

CoherenceSync.InterpolationLoop

Remarks

If the is true, the FixedUpdate loop will always be used in addition to other loops from this setting.

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

UnityEvent

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

UnityEvent

OnInputSimulatorConnected

public UnityEvent OnInputSimulatorConnected

Field Value

UnityEvent

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

UnityEvent

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

UnityEvent

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 .

public bool approveAuthorityTransferRequests

Field Value

bool

authorityTransferType

How this entity should respond to requests for authority (via RequestAuthority(AuthorityType)) by other clients.

public CoherenceSync.AuthorityTransferType authorityTransferType

Field Value

CoherenceSync.AuthorityTransferType

bindings

public List<Binding> bindings

Field Value

List<Binding>

coherenceTag

A user-defined string that can be used by CoherenceTagQuery.

[CoherenceTag]
public string coherenceTag

Field Value

string

floatingOriginMode

public CoherenceSync.FloatingOriginMode floatingOriginMode

Field Value

CoherenceSync.FloatingOriginMode

floatingOriginParentedMode

public CoherenceSync.FloatingOriginMode floatingOriginParentedMode

Field Value

CoherenceSync.FloatingOriginMode

lifetimeType

What should happen to this entity after the client with authority over it disconnects or abandons it.

public CoherenceSync.LifetimeType lifetimeType

Field Value

CoherenceSync.LifetimeType

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

CoherenceSync.OrphanedBehavior

simulationType

How and where this entity is simulated.

public CoherenceSync.SimulationType simulationType

Field Value

CoherenceSync.SimulationType

uniquenessType

Should this entity enforce that only a single instance with the same CoherenceUUID can exist at the same time.

public CoherenceSync.UniquenessType uniquenessType

Field Value

CoherenceSync.UniquenessType

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

ToolkitArchetype

ArchetypeName

public string ArchetypeName { get; }

Property Value

string

AuthorityTransferTypeConfig

public CoherenceSync.AuthorityTransferType AuthorityTransferTypeConfig { get; }

Property Value

CoherenceSync.AuthorityTransferType

AuthorityType

[Obsolete("Please use the 'EntityState.AuthorityType' property instead.")]
[Deprecated("10/01/2023", 1, 0, 0, Reason = "Replaced by 'EntityState.AuthorityType'")]
public AuthorityType AuthorityType { get; }

Property Value

AuthorityType

BakedScript

public CoherenceSyncBaked BakedScript { get; }

Property Value

CoherenceSyncBaked

Bindings

public List<Binding> Bindings { get; }

Property Value

List<Binding>

CoherenceBridge

The CoherenceBridge that this entity is connecting through.

public CoherenceBridge CoherenceBridge { get; }

Property Value

CoherenceBridge

CoherenceSyncConfig

public CoherenceSyncConfig CoherenceSyncConfig { get; }

Property Value

CoherenceSyncConfig

CoherenceTag

public string CoherenceTag { get; set; }

Property Value

string

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

CoherenceSync

EntityID

[Obsolete("Please use the 'EntityState.EntityID' property instead.")]
[Deprecated("10/01/2023", 1, 0, 0, Reason = "Replaced by 'EntityState.EntityID'")]
public SerializeEntityID EntityID { get; }

Property Value

SerializeEntityID

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

NetworkEntityState

HasInput

True if the entity has a CoherenceInput component.

public bool HasInput { get; }

Property Value

bool

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

bool

HasParentWithCoherenceSync

public bool HasParentWithCoherenceSync { get; }

Property Value

bool

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

bool

Input

Retreive the CoherenceInput component on this entity, if it has one.

public CoherenceInput Input { get; }

Property Value

CoherenceInput

InterpolationLocationConfig

public CoherenceSync.InterpolationLoop InterpolationLocationConfig { get; }

Property Value

CoherenceSync.InterpolationLoop

IsConnectedEntityChangeOverridden

Informs if the ConnectedEntityChangeOverride is overridden with a custom method.

public bool IsConnectedEntityChangeOverridden { get; }

Property Value

bool

IsMyClientConnection

[Obsolete("Please use the 'EntityState.IsMyClientConnection' property instead.")]
[Deprecated("10/01/2023", 1, 0, 0, Reason = "Replaced by 'EntityState.IsMyClientConnection'")]
public bool IsMyClientConnection { get; }

Property Value

bool

IsPersistent

True if the lifetime is Persistent.

public bool IsPersistent { get; }

Property Value

bool

IsUnique

public bool IsUnique { get; }

Property Value

bool

LifetimeTypeConfig

public CoherenceSync.LifetimeType LifetimeTypeConfig { get; }

Property Value

CoherenceSync.LifetimeType

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

string

NetworkInstantiated

[Obsolete("Please use the 'EntityState.NetworkInstantiated' property instead.")]
[Deprecated("10/01/2023", 1, 0, 0, Reason = "Replaced by 'EntityState.NetworkInstantiated'")]
public bool NetworkInstantiated { get; }

Property Value

bool

OnFloatingOriginShifted

public Action<Vector3, Vector3> OnFloatingOriginShifted { get; set; }

Property Value

Action<Vector3, Vector3>

OrphanedBehaviorConfig

public CoherenceSync.OrphanedBehavior OrphanedBehaviorConfig { get; }

Property Value

CoherenceSync.OrphanedBehavior

PreserveChildren

public bool PreserveChildren { get; }

Property Value

bool

SimulationTypeConfig

public CoherenceSync.SimulationType SimulationTypeConfig { get; }

Property Value

CoherenceSync.SimulationType

Updater

public ICoherenceSyncUpdater Updater { get; }

Property Value

ICoherenceSyncUpdater

UseReflection

public bool UseReflection { get; }

Property Value

bool

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

bool

isOrphaned

[Obsolete("Please use the 'EntityState.IsOrphaned' property instead.")]
[Deprecated("10/01/2023", 1, 0, 0, Reason = "Replaced by 'EntityState.IsOrphaned'")]
public bool isOrphaned { get; }

Property Value

bool

logger

public Logger logger { get; }

Property Value

Logger

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 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.)

DestroyAsDuplicate()

public void DestroyAsDuplicate()

HandleDisconnected()

public void HandleDisconnected()

HandleNetworkedDestruction()

public void HandleNetworkedDestruction()

InitializeReplacedUniqueObject(SpawnInfo)

public void InitializeReplacedUniqueObject(SpawnInfo info)

Parameters

info SpawnInfo

OnNetworkCommandReceived(object, byte[])

public void OnNetworkCommandReceived(object sender, byte[] data)

Parameters

sender object
data byte[]

RaiseOnAuthorityRequested(ClientID, AuthorityType)

public bool RaiseOnAuthorityRequested(ClientID requesterID, AuthorityType authorityType)

Parameters

requesterID ClientID
authorityType AuthorityType

Returns

bool

RaiseOnConnectedEntityChanged()

For internal use only.

public void RaiseOnConnectedEntityChanged()

ReceiveCommand(IEntityCommand, MessageTarget)

public void ReceiveCommand(IEntityCommand command, MessageTarget target)

Parameters

command IEntityCommand
target MessageTarget

RequestAuthority(AuthorityType)

Try to get authority over this entity. Listen to the events and 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 Action

Action instance of the component and method command that you wish to send

target MessageTarget

To 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 Type

The type of the Unity component that contains the method to call.

methodName string

The name of the method to call. Tip: use C#'s nameof() operator to avoid name mismatches.

target MessageTarget

To 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 Type

The type of the Unity component that contains the method to call.

methodName string

The name of the method to call. Tip: use C#'s nameof() operator to avoid name mismatches.

target MessageTarget

To 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 Type

The type of the Unity component that contains the method to call.

methodName string

The name of the method to call. Tip: use C#'s nameof() operator to avoid name mismatches.

target MessageTarget

To 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 Type

The type of the Unity component that contains the method to call.

methodName string

The name of the method to call. Tip: use C#'s nameof() operator to avoid name mismatches.

target MessageTarget

To 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 Type

The type of the Unity component that contains the method to call.

methodName string

The name of the method to call. Tip: use C#'s nameof() operator to avoid name mismatches.

target MessageTarget

To 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 Type

The type of the Unity component that contains the method to call.

methodName string

The name of the method to call. Tip: use C#'s nameof() operator to avoid name mismatches.

target MessageTarget

To 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 string

The name of the method to call. Tip: use C#'s nameof() operator to avoid name mismatches.

target MessageTarget

To 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 string

The name of the method to call. Tip: use C#'s nameof() operator to avoid name mismatches.

target MessageTarget

To 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 string

The name of the method to call. Tip: use C#'s nameof() operator to avoid name mismatches.

target MessageTarget

To 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 MessageTarget

To which clients should this command be sent.

param1 T

Argument 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 string

The name of the method to call. Tip: use C#'s nameof() operator to avoid name mismatches.

target MessageTarget

To 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 string

The name of the method to call. Tip: use C#'s nameof() operator to avoid name mismatches.

target MessageTarget

To 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 string

The name of the method to call. Tip: use C#'s nameof() operator to avoid name mismatches.

target MessageTarget

To 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 MessageTarget

To which clients should this command be sent.

param1 T1

Argument of type T1 to send to the method

param2 T2

Argument 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 MessageTarget

To which clients should this command be sent.

param1 T1

Argument of type T1 to send to the method

param2 T2

Argument of type T2 to send to the method

param3 T3

Argument 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 MessageTarget

To which clients should this command be sent.

param1 T1

Argument of type T1 to send to the method

param2 T2

Argument of type T2 to send to the method

param3 T3

Argument of type T3 to send to the method

param4 T4

Argument 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 MessageTarget

To which clients should this command be sent.

param1 T1

Argument of type T1 to send to the method

param2 T2

Argument of type T2 to send to the method

param3 T3

Argument of type T3 to send to the method

param4 T4

Argument of type T4 to send to the method

param5 T5

Argument 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 MessageTarget

To which clients should this command be sent.

param1 T1

Argument of type T1 to send to the method

param2 T2

Argument of type T2 to send to the method

param3 T3

Argument of type T3 to send to the method

param4 T4

Argument of type T4 to send to the method

param5 T5

Argument of type T5 to send to the method

param6 T6

Argument 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 MessageTarget

To which clients should this command be sent.

param1 T1

Argument of type T1 to send to the method

param2 T2

Argument of type T2 to send to the method

param3 T3

Argument of type T3 to send to the method

param4 T4

Argument of type T4 to send to the method

param5 T5

Argument of type T5 to send to the method

param6 T6

Argument of type T6 to send to the method

param7 T7

Argument 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 MessageTarget

To which clients should this command be sent.

param1 T1

Argument of type T1 to send to the method

param2 T2

Argument of type T2 to send to the method

param3 T3

Argument of type T3 to send to the method

param4 T4

Argument of type T4 to send to the method

param5 T5

Argument of type T5 to send to the method

param6 T6

Argument of type T6 to send to the method

param7 T7

Argument of type T7 to send to the method

param8 T8

Argument 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 ClientID

ClientID of the client that should get authority over this entity. ClientID can be retrieved from the ClientConnections.

authorityTransferred AuthorityType

Type 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

componentType Type
name string
returnBinding Binding

Returns

bool

TryGetBindingByGuid(string, out Binding)

public bool TryGetBindingByGuid(string bindingGuid, out Binding outBinding)

Parameters

bindingGuid string
outBinding Binding

Returns

bool

UpdateHierarchy()

public void UpdateHierarchy()

ValidateConnectedEntity()

public void ValidateConnectedEntity()

ValueUpdated(AuthorityType, AuthorityType)

public void ValueUpdated(AuthorityType oldAuthorityType, AuthorityType newAuthorityType)

Parameters

oldAuthorityType AuthorityType
newAuthorityType AuthorityType

Events

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

CoherenceSync.ConnectedEntityChangeHandler

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

CoherenceSync.ConnectedEntitySentHandler

OnAuthorityRequested

Raised when other client requests an authority over this entity and the authorityTransferType is set to Request.

public event CoherenceSync.OnAuthorityRequestedHandler OnAuthorityRequested

Event Type

CoherenceSync.OnAuthorityRequestedHandler