Class GameObjectExtensions
Inheritance
object
GameObjectExtensions
Namespace: TetraCreations.Core
Assembly: cs.temp.dll.dll
Syntax
public static class GameObjectExtensions
Methods
DoesInstanceExist<T>()
Determine if any instance of a specific game object type exist in the current scene
Declaration
public static bool DoesInstanceExist<T>()
Returns
Type Parameters
GetChildOrDefault(GameObject, int)
Try to get the Transform at a specific index from the GameObject childs
Declaration
public static Transform GetChildOrDefault(this GameObject gameObject, int index)
Parameters
Type |
Name |
Description |
GameObject |
gameObject |
|
int |
index |
|
Returns
Type |
Description |
Transform |
|
GetChildren(GameObject, List<GameObject>)
Add children to a list from a gameObject recursively
Declaration
public static void GetChildren(this GameObject parent, List<GameObject> children)
Parameters
Type |
Name |
Description |
GameObject |
parent |
|
List<><GameObject> |
children |
|
GetComponentInChildren<T>(GameObject, ref T)
Try to get a component from the GameObject children
Declaration
public static void GetComponentInChildren<T>(this GameObject gameObject, ref T component) where T : Component
Parameters
Type |
Name |
Description |
GameObject |
gameObject |
|
T |
component |
|
Type Parameters
GetComponentInChildren<T>(GameObject, int)
Declaration
public static T GetComponentInChildren<T>(this GameObject gameObject, int index) where T : Component
Parameters
Type |
Name |
Description |
GameObject |
gameObject |
|
int |
index |
|
Returns
Type Parameters
GetComponentInParent<T>(GameObject, ref T)
Try to get a component from the GameObject parent
Declaration
public static void GetComponentInParent<T>(this GameObject gameObject, ref T component) where T : Component
Parameters
Type |
Name |
Description |
GameObject |
gameObject |
|
T |
component |
|
Type Parameters
GetComponentInParentOrChildren<T>(GameObject, ref T)
Trie to get a component from the parent then from children if it wasn't found.
Declaration
public static void GetComponentInParentOrChildren<T>(this GameObject gameObject, ref T component) where T : Component
Parameters
Type |
Name |
Description |
GameObject |
gameObject |
|
T |
component |
|
Type Parameters
GetFirstChildren(GameObject)
Returns children gameObject at the fist level in the hierarchy.
Declaration
public static List<GameObject> GetFirstChildren(this GameObject parent)
Parameters
Type |
Name |
Description |
GameObject |
parent |
|
Returns
Type |
Description |
List<><GameObject> |
|
GetOrAddComponent<T>(GameObject)
Returns a component if it exist otherwise add it.
Declaration
public static T GetOrAddComponent<T>(this GameObject gameObject) where T : Component
Parameters
Type |
Name |
Description |
GameObject |
gameObject |
|
Returns
Type Parameters
HasComponent<T>(GameObject)
Determines whether the game object has the component
Declaration
public static bool HasComponent<T>(this GameObject gameObject) where T : Component
Parameters
Type |
Name |
Description |
GameObject |
gameObject |
|
Returns
Type Parameters
IsActive(GameObject)
Determine if the GameObject is active in the hierarchy
Declaration
public static bool IsActive(this GameObject gameObject)
Parameters
Type |
Name |
Description |
GameObject |
gameObject |
|
Returns
Log(GameObject, string, string)
Debug.Log the name of the GameObject followed by a message.
Declaration
public static void Log(this GameObject gameObject, string message, string separator = " : ")
Parameters
Type |
Name |
Description |
GameObject |
gameObject |
|
string |
message |
|
string |
separator |
|