GameObjectExtensions

Static Class in Zigurous.Utility

Declaration

public static class GameObjectExtensions

Description

Extension methods for Unity GameObjects.

Extension Methods

SetLayerInChildrenSets the layer of the game object and all of its children.
DestroyAllChildrenDestroys all children game objects.
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.
CopyComponent_UNSAFE<T>Copies a component from one game object to another with the exact same values.