Table of Contents

Class CoherenceSyncConfigUtils

Namespace
Coherence.Editor
Assembly
Coherence.Editor.dll

Utility class for CoherenceSyncConfig related operations.

public static class CoherenceSyncConfigUtils
Inheritance
CoherenceSyncConfigUtils

Methods

Checks if an unlinked config can be linked.

public static bool CanLink(CoherenceSyncConfig config)

Parameters

config CoherenceSyncConfig

Returns

bool

true if linkage is possible; false otherwise.

Exceptions

ArgumentNullException

When config is null.

Create(Object)

Create an CoherenceSync Config for the given Unity Object.

public static CoherenceSyncConfig Create(Object obj)

Parameters

obj Object

Reference to the Unity Object that you want to create a CoherenceSync Config for.

Returns

CoherenceSyncConfig

The created CoherenceSyncConfig, or the existing one.

Remarks

Only GameObjects with the CoherenceSync component attached are supported as CoherenceSync Objects at the moment.

CreateObjectInstantiator(CoherenceSyncConfig, Type)

Creates a new instance of a type implementing INetworkObjectInstantiator and assigns it to the given CoherenceSyncConfig.

public static void CreateObjectInstantiator(CoherenceSyncConfig config, Type type)

Parameters

config CoherenceSyncConfig
type Type

CreateObjectProvider(CoherenceSyncConfig, Type)

Creates a new instance of a type implementing INetworkObjectProvider and assigns it to the given CoherenceSyncConfig.

public static bool CreateObjectProvider(CoherenceSyncConfig config, Type type)

Parameters

config CoherenceSyncConfig
type Type

Returns

bool

true if the provider can be changed; false otherwise.

Delete(CoherenceSyncConfig)

Delete an existing CoherenceSyncConfig. If it's an asset, the asset will be deleted. This includes it being a subasset. If it's not an asset, it's destroyed.

Modifying several subassets on the same asset while on a batch (AssetDatabase.[Start|Stop]AssetEditing) will corrupt the asset.

public static bool Delete(CoherenceSyncConfig config)

Parameters

config CoherenceSyncConfig

Returns

bool

Attempt to link a CoherenceSyncConfig with its CoherenceSync counterpart.

public static bool Link(CoherenceSyncConfig config)

Parameters

config CoherenceSyncConfig

The CoherenceSyncConfig to link.

Returns

bool

true if linkage was successful; false otherwise.

Linking tries to locate a CoherenceSync asset based on the ID. It also sets the CoherenceSyncConfig property on the CoherenceSync component.

Exceptions

ArgumentNullException

When config is null.

See Also

TryGetFromAsset(Object, out CoherenceSyncConfig)

public static bool TryGetFromAsset(Object obj, out CoherenceSyncConfig config)

Parameters

obj Object
config CoherenceSyncConfig

Returns

bool

Events

OnAfterConfigCreated

Raised after the asset is created and initialized through Create(Object), but before registration on the CoherenceSyncConfigRegistry.

public static event Action<CoherenceSyncConfig> OnAfterConfigCreated

Event Type

Action<CoherenceSyncConfig>

OnBeforeConfigDeleted

Raised before a CoherenceSyncConfig asset is deleted through Delete(CoherenceSyncConfig).

public static event Action<CoherenceSyncConfig> OnBeforeConfigDeleted

Event Type

Action<CoherenceSyncConfig>

OnObjectInstantiatorChanged

public static event Action<CoherenceSyncConfig, INetworkObjectInstantiator, INetworkObjectInstantiator> OnObjectInstantiatorChanged

Event Type

Action<CoherenceSyncConfig, INetworkObjectInstantiator, INetworkObjectInstantiator>

OnObjectProviderChanged

Raised after Provider changes through a CreateObjectProvider(CoherenceSyncConfig, Type) call.

public static event Action<CoherenceSyncConfig, INetworkObjectProvider, INetworkObjectProvider> OnObjectProviderChanged

Event Type

Action<CoherenceSyncConfig, INetworkObjectProvider, INetworkObjectProvider>