Table of Contents

Interface ICustomPrefab

Namespace
Nautilus.Assets
Assembly
Nautilus.dll
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

PrefabInfo

OnPrefabPostProcess

Function that will be executed after the Nautilus's basic processing for Prefab has been completed.
PrefabPostProcessorAsync OnPrefabPostProcess { get; }

Property Value

PrefabPostProcessorAsync

Prefab

Function which constructs a game object for this prefab.
PrefabFactoryAsync Prefab { get; }

Property Value

PrefabFactoryAsync

Methods

AddGadget<TGadget>(TGadget)

Adds a gadget to this custom prefab.
TGadget AddGadget<TGadget>(TGadget gadget) where TGadget : Gadget

Parameters

gadget TGadget
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

onRegisterCallback Action
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

onUnregisterCallback Action
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

gadgetType Type
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

gadget Type
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

gadget TGadget
The instance of the gadget found associated with the type. If not found, this will be null instead.

Returns

bool
true if the gadget associated with type was found, otherwise; false.

Type Parameters

TGadget
The type of the gadget to get.