Table of Contents

Interface INetworkObjectProvider

Namespace
Coherence.Toolkit
Assembly
Coherence.Toolkit.dll
public interface INetworkObjectProvider

Methods

Initialize(CoherenceSyncConfig)

Editor only method, that is called when an instance of this provider is assigned to a network entry. If Validate returns false, the UI will show a button that will call Initialize again.

void Initialize(CoherenceSyncConfig entry)

Parameters

entry CoherenceSyncConfig

LoadAsset(string)

Called from CoherenceSyncConfig when CoherenceSyncConfig.Instantiate is called, the object is loaded forcing synchronicity. If the provider is naturally asynchronous (Addressables/Asset Bundles), using this method can incur in heavy performance penalties because the main thread will be blocked while the object is loaded.

ICoherenceSync LoadAsset(string networkAssetId)

Parameters

networkAssetId string

Returns

ICoherenceSync

LoadAsset(string, Action<ICoherenceSync>)

Called when coherence needs to load a prefab to memory, to instantiate it when a new network entity is created.

void LoadAsset(string networkAssetId, Action<ICoherenceSync> onLoaded)

Parameters

networkAssetId string
onLoaded Action<ICoherenceSync>

OnApplicationQuit()

Called when the application exits.

void OnApplicationQuit()

Release(ICoherenceSync)

Called when coherence needs to destroy a prefab instance, when the related network entity is destroyed.

void Release(ICoherenceSync obj)

Parameters

obj ICoherenceSync

Validate(CoherenceSyncConfig)

Editor only method, that is called by the UI to validate the serialized data of this Provider.

bool Validate(CoherenceSyncConfig entry)

Parameters

entry CoherenceSyncConfig

Returns

bool