Class GameObjectExtensions
Extension methods for GameObject class.
Namespace: Unity.AnimeToolbox
Syntax
public static class GameObjectExtensions
Methods
DestroyChildrenImmediate(GameObject)
Destroy all children of a GameObject, while allowing assets to be destroyed.
Declaration
public static void DestroyChildrenImmediate(this GameObject go)
Parameters
Type | Name | Description |
---|---|---|
GameObject | go | The GameObject which children will be destroyed. |
DestroyChildrenImmediate(Transform)
Destroy all children of a Transform, while allowing assets to be destroyed.
Declaration
public static void DestroyChildrenImmediate(this Transform t)
Parameters
Type | Name | Description |
---|---|---|
Transform | t | The Transform which children will be destroyed. |
GetOrAddComponent<T>(GameObject)
Returns the component of Type type. If one doesn't already exist on the GameObject it will be added.
Declaration
public static T GetOrAddComponent<T>(this GameObject gameObject)
where T : Component
Parameters
Type | Name | Description |
---|---|---|
GameObject | gameObject | The GameObject this Component is attached to. |
Returns
Type | Description |
---|---|
T | Component |
Type Parameters
Name | Description |
---|---|
T | The type of Component to return. |