PrefabManager
A static class in Root.Township, Alta.Networking.
Static lookup of every NetworkPrefab by hash, loaded from the Network Prefabs resources folder on first use. Use GetPrefab to find a prefab to spawn.
- Listed in Networking and servers
- Documented in Prefabs and prefab hashes
Fields
2 private and internal fields
| Member | What it is |
|---|---|
private static Logger logger | Logger for this class. |
private static Dictionary<uint, NetworkPrefab> prefabMap | Prefabs by hash, or null until loaded. |
Properties
| Member | What it is |
|---|---|
static IEnumerable<NetworkPrefab> AllPrefabs { get; } | Every loaded prefab. Throws if nothing has loaded the map yet, so call PrepareSpawnSetups first. |
Methods
| Member | What it is |
|---|---|
static bool Exists(uint hash) | Whether a prefab with this hash exists. |
static NetworkPrefab GetPrefab(uint hash) | Finds a prefab by hash, or by string: the hash as text, or the lowercase name with or without spaces. The string is not lowercased for you. |
static NetworkPrefab GetPrefab(string name) | Finds a prefab by hash, or by string: the hash as text, or the lowercase name with or without spaces. The string is not lowercased for you. |
static void PrepareSpawnSetups() | Loads all network prefabs once and, on headless builds, strips their meshes, materials, lights and cameras. |
4 private and internal methods
| Member | What it is |
|---|---|
private static void AddToPrefabMap(NetworkPrefab[] prefabs) | Adds prefabs to the map by hash, logging an error for any duplicate hash. |
private static void FindPrefabsOutOfFolder(NetworkPrefab[] prefabs) | Empty. |
private static void RemoveAllMaterialsAndMeshesOnPrefabs() | Headless: clears and disables renderers, meshes, lights and cameras on all resource prefabs to save memory. |
private static void ValidateAllEmbeddedHashes(NetworkPrefab[] prefabs) | Checks each prefab's embedded entity hashes; not called here. |