Table of Contents

Class DirectReferenceProvider

Namespace
Coherence.Toolkit
Assembly
Coherence.Toolkit.dll
[DisplayName("Direct Reference", "Load this prefab using a direct reference to the asset. The prefab cannot be inside a Resources folder.")]
public sealed class DirectReferenceProvider : INetworkObjectProvider
Inheritance
DirectReferenceProvider
Implements

Constructors

DirectReferenceProvider()

public DirectReferenceProvider()

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.

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

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

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

Parameters

networkAssetId string
onLoaded Action<ICoherenceSync>

OnApplicationQuit()

Called when the application exits.

public void OnApplicationQuit()

Release(ICoherenceSync)

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

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

public bool Validate(CoherenceSyncConfig entry)

Parameters

entry CoherenceSyncConfig

Returns

bool