Class ModPrefabCache
Class used by the prefab system to store GameObjects.
Objects in the cache are inactive because they are placed within an inactive parent object.
public static class ModPrefabCache
- Inheritance
-
ModPrefabCache
- Inherited Members
Methods
AddPrefab(GameObject)
Adds the given prefab to the cache.
public static void AddPrefab(GameObject prefab)
Parameters
prefab
GameObject- The prefab object that is disabled and cached.
IsPrefabCached(string)
Determines if a prefab is already cached, searching by class id.
public static bool IsPrefabCached(string classId)
Parameters
classId
string- The class id to search for.
Returns
- bool
- True if a prefab by the given
classId
exists in the cache, otherwise false.
RemovePrefabFromCache(string)
Any prefab with the matching
classId
will be removed from the cache.public static void RemovePrefabFromCache(string classId)
Parameters
classId
string- The class id of the prefab that will be removed.
Remarks
This operation is extremely dangerous on custom prefabs that are directly registering an asset bundle prefab as it may make the prefab unusable in the current session.
Avoid using this method unless you know what you're doing.
Avoid using this method unless you know what you're doing.
TryGetPrefabFromCache(string, out GameObject)
Attempts to fetch a prefab from the cache by its
classId
. The prefab
out parameter is set to the prefab, if any was found.public static bool TryGetPrefabFromCache(string classId, out GameObject prefab)
Parameters
classId
string- The class id of the prefab we are searching for.
prefab
GameObject- The prefab that may or may not be found.
Returns
- bool
- True if the prefab was found in the cache, otherwise false.