GameObjectExtensions

Static Class in Zigurous.Architecture

Declaration

public static class GameObjectExtensions

Description

Extension methods for Unity GameObjects.

Extension Methods

SetLayerInChildrenSets the layer of the parent game object and all of its children.
DestroyChildrenDestroys all children game objects of the parent.
DestroyChildrenImmediateDestroys all children game objects of the parent immediately. You are strongly recommended to use DestroyChildren instead.
GetRequiredComponent<T>Gets the specified component from the game object. If the component does not exist, then it will be added to the game object.
HasComponent<T>Checks if the game object has a component of the specified type.
HasComponentChecks if the game object has a component of the specified type.
HasComponentInChildren<T>Checks if the game object has a component of the specified type on itself or on any of its children using depth first search.
HasComponentInChildrenChecks if the game object has a component of the specified type on itself or on any of its children using depth first search.
HasComponentInParent<T>Checks if the game object has a component of the specified type on itself or any of its parents.
HasComponentInParentChecks if the game object has a component of the specified type on itself or any of its parents.