GameObjectExtensions

Class in ChivalrousGames.Common

Description

Contains helper methods for GameObject

Static Methods

IsNull
public static bool IsNull(GameObject gameObject);
Parameters
gameObject GameObject The game object to check for null
Return

True if the game object is null

Description

Verifies if a game object is null in a null safe way.

SetLayerRecursively
public static void SetLayerRecursively(this GameObject obj, int layer);
Parameters
obj GameObject The game object on which to set a layer recursively (assign it to all children too).
layer int Layer to assign
Description

A helper method to assign a physics layer to a game object and to all its children at the same time.

SafeDestroy
public static void SafeDestroy(this GameObject obj, float t = 0.0f);
Parameters
obj GameObject The object to destroy.
t float The optional amount of time (in seconds) to delay before destroying the object. (works only at runtime)
Description

A destroy method for a game object that handles runtime / design time

SafeDestroy
public static void SafeDestroy(Object obj, float t = 0.0f);
Parameters
obj Object The object to destroy.
t float The optional amount of time (in seconds) to delay before destroying the object. (works only at runtime)
Description

A destroy method for a generic object that handles runtime / design time