Table of Contents

Class GameObjectExtensionMethods

Namespace
CodeBase
Assembly
4Experience.CodeBase.Core.Runtime.dll
public static class GameObjectExtensionMethods
Inheritance
GameObjectExtensionMethods

Methods

ChangeLayerRecursively(GameObject, int)

Set gameobject and all its children's layer to new layer by index int value.

public static void ChangeLayerRecursively(this GameObject target, int layerIndex)

Parameters

target GameObject
layerIndex int

ChangeLayerRecursively(GameObject, string)

Set gameobject and all its children's layer to new layer by name string value.

public static void ChangeLayerRecursively(this GameObject target, string layerName)

Parameters

target GameObject
layerName string

DestroyClear(List<GameObject>, bool)

Destroy all gameobject from list then clear list.

public static void DestroyClear(this List<GameObject> target, bool immediate = false)

Parameters

target List<GameObject>
immediate bool

ForceRefreshObject(GameObject)

Turn off then turn on gameobject - use optimized solution.

public static void ForceRefreshObject(this GameObject target)

Parameters

target GameObject

GetLayerMaskBitValue(GameObject)

public static int GetLayerMaskBitValue(this GameObject target)

Parameters

target GameObject

Returns

int

GetMeshRenderersByTag(GameObject, string)

Collect gameobject children's MeshRenderers to list if them tag is equal to target tag.

public static List<MeshRenderer> GetMeshRenderersByTag(this GameObject source, string targetTag)

Parameters

source GameObject
targetTag string

Returns

List<MeshRenderer>

GetObjectBoundsFromColliders(GameObject)

A component Collider on the gameobject is required.

public static Bounds GetObjectBoundsFromColliders(this GameObject target)

Parameters

target GameObject

Returns

Bounds

GetObjectBoundsFromRenderers(GameObject)

A component MeshRenderer on the gameobject is required.

public static Bounds GetObjectBoundsFromRenderers(this GameObject target)

Parameters

target GameObject

Returns

Bounds

IsObjectOnLayerMask(GameObject, LayerMask)

public static bool IsObjectOnLayerMask(this GameObject target, LayerMask checkLayer)

Parameters

target GameObject
checkLayer LayerMask

Returns

bool

SetActiveAll(List<GameObject>, bool)

Change active state of all gameobjects from list use optimized solution.

public static void SetActiveAll(this List<GameObject> target, bool state)

Parameters

target List<GameObject>
state bool

SetActiveAll(GameObject[], bool)

Change active state of all gameobjects from array use optimized solution.

public static void SetActiveAll(this GameObject[] target, bool state)

Parameters

target GameObject[]
state bool

SetActiveOptimized(GameObject, bool)

Set gameobject active state if its active state is not equal to target state.

public static void SetActiveOptimized(this GameObject target, bool state)

Parameters

target GameObject
state bool