Interface ICustomPrefab
Specifies the contract for a custom prefab.
public interface ICustomPrefab
- Extension Methods
Properties
Info
The prefab info for this custom prefab.
PrefabInfo Info { get; }
Property Value
OnPrefabPostProcess
Function that will be executed after the Nautilus's basic processing for Prefab has been completed.
PrefabPostProcessorAsync OnPrefabPostProcess { get; }
Property Value
Prefab
Function which constructs a game object for this prefab.
PrefabFactoryAsync Prefab { get; }
Property Value
Methods
AddGadget<TGadget>(TGadget)
Adds a gadget to this custom prefab.
TGadget AddGadget<TGadget>(TGadget gadget) where TGadget : Gadget
Parameters
gadgetTGadget- The gadget to add
Returns
- TGadget
- A reference to the added gadget.
Type Parameters
TGadget- Type of the gadget.
AddOnRegister(Action)
Adds an action that will be called during the registration of the prefab.
void AddOnRegister(Action onRegisterCallback)
Parameters
onRegisterCallbackAction- The action that will be called.
AddOnUnregister(Action)
Adds an action that will be called when this prefab has performed an unregister operation.
void AddOnUnregister(Action onUnregisterCallback)
Parameters
onUnregisterCallbackAction- The action that will be called.
GetGadget(Type)
Gets the gadget instance associated with the specified gadget type attached to this custom prefab.
Gadget GetGadget(Type gadgetType)
Parameters
gadgetTypeType- The type of the gadget to get.
Returns
- Gadget
- The gadget instance if found, otherwise;
null.
GetGadget<TGadget>()
Gets the gadget instance associated with the specified gadget type attached to this custom prefab.
TGadget GetGadget<TGadget>() where TGadget : Gadget
Returns
- TGadget
- The gadget instance if found, otherwise;
null.
Type Parameters
TGadget- The type of the gadget to get.
RemoveGadget(Type)
Removes the gadget with the specified type.
bool RemoveGadget(Type gadget)
Parameters
gadgetType- The type of the gadget to remove.
Returns
- bool
- true if the gadget was successfully found and removed, otherwise; false.
This method returns false if the gadget type was not found in this custom prefab.
RemoveGadget<TGadget>()
Removes the gadget with the specified type.
bool RemoveGadget<TGadget>() where TGadget : Gadget
Returns
- bool
- true if the gadget was successfully found and removed, otherwise; false.
This method returns false if the gadget type was not found in this custom prefab.
Type Parameters
TGadget- The type of the gadget to remove.
TryGetGadget<TGadget>(out TGadget)
Gets the gadget instance associated with the specified gadget type attached to this custom prefab.
bool TryGetGadget<TGadget>(out TGadget gadget) where TGadget : Gadget
Parameters
gadgetTGadget- The instance of the gadget found associated with the type. If not found, this will be
nullinstead.
Returns
Type Parameters
TGadget- The type of the gadget to get.