PrefabLoadManager
A static class in Root.Township, Alta.Chunks.
Reference counts prefabs loaded through chunk prefab pointers: the prefab is instantiated when the first chunk needs it and destroyed when the last one lets go.
- Listed in World, chunks and saving
Fields
5 private and internal fields
| Member | What it is |
|---|---|
private static ResourceRequest asyncRequest | Unused resource request field. |
private static Transform instantiatedFolder | Backing field for InstantiatedFolder. |
private static Dictionary<uint, HashSet<Chunk>> loadedPointerPrefabs | The chunks using each pointer, by pointer id. |
private static Dictionary<uint, ChunkPrefabPointer> pointersByID | Pointers by id, for the id overloads. Nothing in this class fills it, so those overloads log an error. |
private static Dictionary<uint, GameObject> prefabReferencesInScene | The live instance for each pointer id, or null. |
Properties
| Member | What it is |
|---|---|
static Transform InstantiatedFolder { get; } | The Static Objects Folder GameObject loaded pointer prefabs are put under. Made on first use. |
Methods
| Member | What it is |
|---|---|
static GameObject LoadPointer(Chunk chunk, uint pointerID) | Marks the chunk as using the pointer and returns the shared instance, creating it if needed. |
static GameObject LoadPointer(Chunk chunk, ChunkPrefabPointer pointer) | Marks the chunk as using the pointer and returns the shared instance, creating it if needed. |
static bool UnloadPointer(Chunk chunk, uint pointerID) | Removes the chunk's use of the pointer and destroys the instance when no chunk uses it. True if destroyed. |
static bool UnloadPointer(Chunk chunk, ChunkPrefabPointer pointer) | Removes the chunk's use of the pointer and destroys the instance when no chunk uses it. True if destroyed. |