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
targetGameObjectlayerIndexint
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
targetGameObjectlayerNamestring
DestroyClear(List<GameObject>, bool)
Destroy all gameobject from list then clear list.
public static void DestroyClear(this List<GameObject> target, bool immediate = false)
Parameters
ForceRefreshObject(GameObject)
Turn off then turn on gameobject - use optimized solution.
public static void ForceRefreshObject(this GameObject target)
Parameters
targetGameObject
GetLayerMaskBitValue(GameObject)
public static int GetLayerMaskBitValue(this GameObject target)
Parameters
targetGameObject
Returns
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
sourceGameObjecttargetTagstring
Returns
- List<MeshRenderer>
GetObjectBoundsFromColliders(GameObject)
A component Collider on the gameobject is required.
public static Bounds GetObjectBoundsFromColliders(this GameObject target)
Parameters
targetGameObject
Returns
- Bounds
GetObjectBoundsFromRenderers(GameObject)
A component MeshRenderer on the gameobject is required.
public static Bounds GetObjectBoundsFromRenderers(this GameObject target)
Parameters
targetGameObject
Returns
- Bounds
IsObjectOnLayerMask(GameObject, LayerMask)
public static bool IsObjectOnLayerMask(this GameObject target, LayerMask checkLayer)
Parameters
targetGameObjectcheckLayerLayerMask
Returns
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
SetActiveAll(GameObject[], bool)
Change active state of all gameobjects from array use optimized solution.
public static void SetActiveAll(this GameObject[] target, bool state)
Parameters
targetGameObject[]statebool
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
targetGameObjectstatebool