Table of Contents

Class ResourcesProvider

Namespace
Coherence.Toolkit
Assembly
Coherence.Toolkit.dll
[DisplayName("Resources", "Load this prefab using the Resources system. The prefab must be inside a Resources folder.")]
public sealed class ResourcesProvider : INetworkObjectProvider
Inheritance
ResourcesProvider
Implements

Constructors

ResourcesProvider()

public ResourcesProvider()

Properties

References

public int References { get; }

Property Value

int

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