Nebula
Containers

IInstanceContentLoader

Content of an instance part that finishes loading after InstanceScenes.Prepare returns: geometry a component builds over several frames, or assets it loads asynchronously.

generated from the sources
public interface IInstanceContentLoader

Content of an instance part that finishes loading after InstanceScenes.Prepare returns: geometry a component builds over several frames, or assets it loads asynchronously.

Implement it on a component of the part's content prefab (InstanceTemplate.Part.ContentResource), or on one the game adds under the part's container in Awake. When the content is created, Nebula collects the active components under the container that implement this interface. A portal link (Portal) opens, and a client says it holds the far window (MsgId.PortalWarm), and a client acknowledges a crossing prepared with NebulaWorker.PrepareTransfer into the part, and the destination worker marks itself ready, only once every one of them reports InstanceContentState.Ready. One that reports InstanceContentState.Failed refuses the crossing and keeps a link from opening. Content with none of them is ready as soon as it exists.

Nebula reads State once a frame on a client, and once a tick on a worker, only while a preparation or a link waits for it. Keep it cheap and free of allocations. A crossing prepared with NebulaWorker.PrepareTransfer still expires at its preparation timeout; a Portal link keeps waiting, reporting PortalWait.FarWorkerContent, and stops polling once it is open.

Properties

State

InstanceContentState State { get; }

Whether this content is still loading, complete, or cannot be completed.

Progress

float Progress { get; }

How far loading has got, from 0 to 1. Only InstanceScenes.ContentProgress reads it, to show a loading indicator; State alone decides readiness.

On this page