ChunkPrefabPointer.PointerInstance
A class in Root.Township, Alta.Chunks.
One loaded static scenery pointer (an Addressables prefab) shared by every chunk that uses it. ChunkPrefabPointer creates these and instantiates or destroys them in its load queue.
- Listed in World, chunks and saving
- Nested in
ChunkPrefabPointer
Constructors
| Member | What it is |
|---|---|
PointerInstance(string reference, AsyncOperationHandle<GameObject> handler) | Creates a ChunkPrefabPointer.PointerInstance from reference and handler. |
Properties
| Member | What it is |
|---|---|
AsyncOperationHandle<GameObject> Handler { get; } | The Addressables load handle for the prefab. |
bool IsFinished { get; private set; } | True once the Addressables load has completed. |
bool IsLoaded { get; set; } | True while the prefab is instantiated in the scene. |
TaskCompletionSource<bool> LoadedSource { get; private set; } | Completes true when the pointer is instantiated, or false if every chunk stopped using it first. |
string Reference { get; } | The Addressables key of the prefab. |
GameObject Spawned { get; set; } | The instantiated copy, or null when not loaded. |
HashSet<Chunk> Uses { get; } | The chunks using this pointer right now. |
Methods
| Member | What it is |
|---|---|
bool Unuse(Chunk chunk) | Drops a chunk. When the last one goes, queues the instance for destroying. Returns true if no users are left. |
void Use(Chunk chunk) | Adds a chunk as a user. The first user queues the prefab to be instantiated. |
Used in
Members of other types that take, return or hold a PointerInstance: