Infra

Addressables Service

Ref-counted Addressables asset service with load scopes. Client-only.

Unity package
com.crossplay.assets
Depends on
core
Shape
client-only · no server half

Unity seams you implement 1

The client half's sockets. Bind your implementation in the client context and Crossplay's client calls it — this is where your models, animators, UI and controls plug in.

IAssetScope unity SPI

A disposable loading bucket (a zone's content, a screen's content).

  • UniTask<T> LoadAsync<T>(string key)

    Loads through the service and remembers the key for bulk release.

  • UniTask<int> PreloadLabelAsync<T>(string label)

    Preloads a label and remembers it for bulk release.

Unity services you inject 2

Crossplay binds these in the client context. Inject and call them from your own MonoBehaviours and presenters.

IAssetService

The modular Addressables service — the ONE door every Crossplay client system loads content through. Ref-counted per key (two systems loading the same key share one handle; the asset frees when the LAST one releases), label preloads for bulk content (a zone's set), tracked instantiation, and CreateScope for lifetime-bound loading (release the scope, everything it loaded goes with it — zone streaming and screens ride this).

  • UniTask<T> LoadAsync<T>(string key)

    Loads (or shares) the asset at key; increments its ref count.

  • void Release(string key)

    Decrements a key's ref count; the underlying handle is freed at zero.

  • UniTask<GameObject> InstantiateAsync(string key, Transform parent = null)

    Instantiates an Addressable prefab (tracked; release with ReleaseInstance).

  • void ReleaseInstance(GameObject instance)

    Destroys an instance created by InstantiateAsync and frees its handle.

  • UniTask<int> PreloadLabelAsync<T>(string label)

    Loads EVERY asset under a label (bulk preload; ref-counted as one unit per label).

  • void ReleaseLabel(string label)

    Releases a label preload.

  • IAssetScope CreateScope(string name)

    A lifetime bucket: everything loaded through it releases together on Dispose.

  • IReadOnlyDictionary<string, int> LoadedKeys

    Currently held keys with their ref counts (diagnostics/overlay).

IZoneContentStreamer

The Addressables consumer for zone travel: entering a zone preloads everything under the label prefix+zone into an IAssetScope, and leaving releases the previous zone's scope — content residency follows the player automatically. The GAME decides what each label contains (models, audio banks, VFX) and renders its own loading UI off the events.

  • event Action<string> ZoneLoadStarted

    A zone preload began (zone name).

  • event Action<string, int> ZoneLoadCompleted

    A zone preload finished (zone name, assets resident).

  • string CurrentZone

    The zone whose content is currently resident (empty before the first enter).