Class GameObjectExtensions
Useful methods for GameObjects.
Inherited Members
Namespace: Unity.Behavior
Assembly: Unity.Behavior.dll
Syntax
public static class GameObjectExtensions
Methods
GetOrAddComponent<T>(GameObject)
Gets or adds a component to a GameObject.
Declaration
public static T GetOrAddComponent<T>(this GameObject gameObject) where T : Component
Parameters
Type | Name | Description |
---|---|---|
GameObject | gameObject | the gameObject targeted |
Returns
Type | Description |
---|---|
T | The requested component type, either already on the GameObject or created and added within this method. |
Type Parameters
Name | Description |
---|---|
T | The type of the component required |