Class PrefabManager
Manager for handling custom prefabs added to the game.
Inherited Members
Namespace: Jotunn.Managers
Assembly: Jotunn.dll
Syntax
public class PrefabManager
Properties
Name | Description |
---|---|
Instance | The singleton instance of this manager. |
Methods
Name | Description |
---|---|
AddPrefab(GameObject) | Add a custom prefab to the manager. Checks if a prefab with the same name is already added. Added prefabs get registered to the ZNetScene on ZNetScene.Awake. |
AddPrefab(CustomPrefab) | Add a custom prefab to the manager. Checks if a prefab with the same name is already added. Added prefabs get registered to the ZNetScene on ZNetScene.Awake. |
CreateClonedPrefab(string, GameObject) | Create a copy of a given prefab without modifying the original. |
CreateClonedPrefab(string, string) | Create a copy of a given prefab without modifying the original. |
CreateEmptyPrefab(string, bool) | Create a new prefab from an empty primitive. |
DestroyPrefab(string) | Destroy a custom prefab. Removes it from the manager and if already instantiated also from the ZNetScene. |
GetPrefab(string) | Get a prefab by its name. Search hierarchy:
|
RegisterToZNetScene(GameObject) | Register a single prefab to the current ZNetScene. Checks for existence of the object via GetStableHashCode() and adds the prefab if it is not already added. |
RemovePrefab(string) | Remove a custom prefab from the manager. |
Events
Name | Description |
---|---|
OnPrefabsRegistered | Event that gets fired after registering all custom prefabs to ZNetScene. Your code will execute every time a new ZNetScene is created (on every game start). If you want to execute just once you will need to unregister from the event after execution. |
OnVanillaPrefabsAvailable | Event that gets fired after the vanilla prefabs are in memory and available for cloning. Your code will execute every time before a new ObjectDB is copied (on every menu start). If you want to execute just once you will need to unregister from the event after execution. |