Skip to main content

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.

Fields​

5 private and internal fields
MemberWhat it is
private static ResourceRequest asyncRequestUnused resource request field.
private static Transform instantiatedFolderBacking field for InstantiatedFolder.
private static Dictionary<uint, HashSet<Chunk>> loadedPointerPrefabsThe chunks using each pointer, by pointer id.
private static Dictionary<uint, ChunkPrefabPointer> pointersByIDPointers by id, for the id overloads. Nothing in this class fills it, so those overloads log an error.
private static Dictionary<uint, GameObject> prefabReferencesInSceneThe live instance for each pointer id, or null.

Properties​

MemberWhat it is
static Transform InstantiatedFolder { get; }The Static Objects Folder GameObject loaded pointer prefabs are put under. Made on first use.

Methods​

MemberWhat 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.
1 private and internal method
MemberWhat it is
private static void ClearPointers()Forgets all loaded pointers and their instances on game reload.