Class GameObjectExtension

Namespace: AppMana.InteractionToolkit.MaterialUI

Static class with GameObject extension methods.

public static class GameObjectExtension

Inheritance

object ← GameObjectExtension

Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

Methods

GetAddComponent<T>(GameObject)

Gets a Component on a GameObject if it exists, otherwise add one.

public static T GetAddComponent<T>(this GameObject gameObject) where T : Component

Parameters

gameObject GameObject

The game object to check/add to.

Returns

T

The Component instance.

Type Parameters

T

The type of Component to add.

GetChildByName<T>(GameObject, string)

Gets a child Component by name and type.

public static T GetChildByName<T>(this GameObject gameObject, string name) where T : Component

Parameters

gameObject GameObject

The game object.

name string

The name to search.

Returns

T

The Component found, otherwise null.

Type Parameters

T

The type of Component.