Edit

Share via


GameObjectExtensions Class

Definition

Extension methods for Unity's GameObject class

public ref class GameObjectExtensions abstract sealed
public static class GameObjectExtensions
type GameObjectExtensions = class
Public Module GameObjectExtensions
Inheritance
GameObjectExtensions

Methods

ApplyLayerCacheRecursively(GameObject, Dictionary<GameObject,Int32>)

Reapplies previously cached hierarchy layers

ApplyToHierarchy(GameObject, Action<GameObject>)

Apply the specified delegate to all objects in the hierarchy under a specified game object.

DestroyGameObject(GameObject, Single)

Destroys GameObject appropriately depending if in edit or playmode

ExportOBJAsync(GameObject, String, Boolean)

Export mesh data of current GameObject, and children if enabled, to file provided in OBJ format

FindAncestorComponent<T>(GameObject, Boolean)

Find the first component of type T in the ancestors of the specified game object.

ForEachComponent<T>(GameObject, Action<T>)

Perform an action on every component of type T that is on this GameObject

IsComponentRequired<T>(GameObject, List<Type>)

Checks if any MonoBehaviour on the given GameObject is using the RequireComponentAttribute requiring type T

IsInLayerMask(GameObject, LayerMask)

Determines whether or not a game object's layer is included in the specified layer mask.

SetChildrenActive(GameObject, Boolean)

Set all GameObject children active or inactive based on argument

SetLayerRecursively(GameObject, Int32)

Set the layer to the given object and the full hierarchy below it.

SetLayerRecursively(GameObject, Int32, Dictionary<GameObject,Int32>)

Set the layer to the given object and the full hierarchy below it and cache the previous layers in the out parameter.

Applies to