Table of Contents

Class GLMonoBehaviour

Namespace
Gamelogic.Extensions
Assembly
Assembly-CSharp.dll

Provides some additional functions for MonoBehaviour.

[Version(1, 0, 0)]
[AddComponentMenu("Gamelogic/Extensions/GLMonoBehaviour")]
public class GLMonoBehaviour : MonoBehaviour
Inheritance
GLMonoBehaviour
Derived
Inherited Members
MonoBehaviour.IsInvoking()
MonoBehaviour.StopCoroutine(Coroutine)
MonoBehaviour.StopAllCoroutines()
MonoBehaviour.runInEditMode
Component.GetComponent<T>()
Component.GetComponentInChildren<T>()
Component.GetComponentsInChildren<T>()
Component.GetComponentsInParent<T>()
Component.transform
Component.gameObject
Component.tag
Object.Instantiate(Object, Vector3, Quaternion)
Object.Instantiate(Object)
Object.Instantiate(Object, Transform)
Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
Object.Instantiate<T>(T, Transform)
Object.Destroy(Object)
Object.DestroyImmediate(Object)
Object.DestroyObject(Object)
Object.FindObjectsOfType<T>()
Object.name
Object.hideFlags
Extension Methods

Methods

DestroyUniversal(Object)

Destroys given object using either Object.Destroy, or Object.DestroyImmediate, depending on whether Application.isPlaying is true or not. This is useful when writing methods that is used by both editor tools and the game itself.

[Version(2, 5, 0)]
public static void DestroyUniversal(Object obj)

Parameters

obj Object

The object to destroy.

FindObjectsOfInterface<TInterface>()

Similar to FindObjectsOfType, except that it looks for components that implement a specific interface.

public static List<TInterface> FindObjectsOfInterface<TInterface>() where TInterface : class

Returns

List<TInterface>

Type Parameters

TInterface

GetRequiredComponentInChildren<T>()

Gets a component of the given type in one of the children, or fail if no such component is attached to the given component.

public T GetRequiredComponentInChildren<T>() where T : Component

Returns

T

A component of type T attached to the given component if it exists.

Type Parameters

T

The type of component to get.

Exceptions

InvalidOperationException

When the no component of the required type exist on any of the given components children.

GetRequiredComponent<T>()

Gets a component of the given type, or fail if no such component is attached to the given component.

public T GetRequiredComponent<T>() where T : Component

Returns

T

A component of type T attached to the given component if it exists.

Type Parameters

T

The type of component to get.

Exceptions

InvalidOperationException

When the no component of the required type exist on the given component.

Instantiate(GameObject)

Instantiates a prefab.

public static GameObject Instantiate(GameObject prefab)

Parameters

prefab GameObject

The object.

Returns

GameObject

GameObject.

Instantiate(GameObject, GameObject)

Instantiates a prefab and parents it to the root.

public static GameObject Instantiate(GameObject prefab, GameObject root)

Parameters

prefab GameObject

The prefab.

root GameObject

The root.

Returns

GameObject

GameObject.

Instantiate(GameObject, GameObject, Vector3, Quaternion)

Instantiates a prefab, attaches it to the given root, and sets the local position and rotation.

public static GameObject Instantiate(GameObject prefab, GameObject root, Vector3 localPosition, Quaternion localRotation)

Parameters

prefab GameObject

The prefab.

root GameObject

The root.

localPosition Vector3

The local position.

localRotation Quaternion

The local rotation.

Returns

GameObject

GameObject.

Instantiate(GameObject, Vector3, Quaternion)

Instantiates the specified prefab.

public static GameObject Instantiate(GameObject prefab, Vector3 position, Quaternion rotation)

Parameters

prefab GameObject
position Vector3
rotation Quaternion

Returns

GameObject

Instantiate<T>(T)

Instantiates the specified prefab.

public static T Instantiate<T>(T prefab) where T : Component

Parameters

prefab T

The object.

Returns

T

T.

Type Parameters

T

Instantiate<T>(T, GameObject)

Instantiates a prefab and attaches it to the given root.

public static T Instantiate<T>(T prefab, GameObject root) where T : Component

Parameters

prefab T
root GameObject

Returns

T

Type Parameters

T

Instantiate<T>(T, GameObject, Vector3, Quaternion)

Instantiates a prefab, attaches it to the given root, and sets the local position and rotation.

public static T Instantiate<T>(T prefab, GameObject root, Vector3 localPosition, Quaternion localRotation) where T : Component

Parameters

prefab T
root GameObject
localPosition Vector3
localRotation Quaternion

Returns

T

Type Parameters

T

Instantiate<T>(T, Vector3, Quaternion)

Instantiates an object at the given position in the given orientation.

public static T Instantiate<T>(T prefab, Vector3 position, Quaternion rotation) where T : Component

Parameters

prefab T

The prefab to instantiate.

position Vector3

The position.

rotation Quaternion

The rotation.

Returns

T

T.

Type Parameters

T

Invoke(Action, float)

[Version(2, 3, 0)]
public Coroutine Invoke(Action action, float time)

Parameters

action Action
time float

Returns

Coroutine

InvokeRepeating(Action, IGenerator<float>)

[Version(2, 3, 0)]
public Coroutine InvokeRepeating(Action action, IGenerator<float> repeatTime)

Parameters

action Action
repeatTime IGenerator<float>

Returns

Coroutine

InvokeRepeating(Action, float, float)

[Version(2, 3, 0)]
public Coroutine InvokeRepeating(Action action, float time, float repeatTime)

Parameters

action Action
time float
repeatTime float

Returns

Coroutine

Tween<T>(T, T, float, Func<T, T, float, T>, Action<T>)

[Version(2, 3, 0)]
public Coroutine Tween<T>(T start, T finish, float totalTime, Func<T, T, float, T> lerp, Action<T> action)

Parameters

start T
finish T
totalTime float
lerp Func<T, T, float, T>
action Action<T>

Returns

Coroutine

Type Parameters

T

Tween<T>(T, T, float, Func<T, T, float, T>, Action<T>, Func<float>)

[Version(2, 3, 0)]
public Coroutine Tween<T>(T start, T finish, float totalTime, Func<T, T, float, T> lerp, Action<T> action, Func<float> deltaTime)

Parameters

start T
finish T
totalTime float
lerp Func<T, T, float, T>
action Action<T>
deltaTime Func<float>

Returns

Coroutine

Type Parameters

T