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.runInEditModeComponent.GetComponent<T>()Component.GetComponentInChildren<T>()Component.GetComponentsInChildren<T>()Component.GetComponentsInParent<T>()Component.transformComponent.gameObjectComponent.tagObject.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.nameObject.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
ObjectThe 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
GameObjectThe 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
GameObjectThe prefab.
root
GameObjectThe 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
GameObjectThe prefab.
root
GameObjectThe root.
localPosition
Vector3The local position.
localRotation
QuaternionThe 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
GameObjectposition
Vector3rotation
Quaternion
Returns
Instantiate<T>(T)
Instantiates the specified prefab.
public static T Instantiate<T>(T prefab) where T : Component
Parameters
prefab
TThe 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
Troot
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
Troot
GameObjectlocalPosition
Vector3localRotation
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
TThe prefab to instantiate.
position
Vector3The position.
rotation
QuaternionThe rotation.
Returns
- T
T.
Type Parameters
T
Invoke(Action, float)
[Version(2, 3, 0)]
public Coroutine Invoke(Action action, float time)
Parameters
Returns
InvokeRepeating(Action, IGenerator<float>)
[Version(2, 3, 0)]
public Coroutine InvokeRepeating(Action action, IGenerator<float> repeatTime)
Parameters
action
ActionrepeatTime
IGenerator<float>
Returns
InvokeRepeating(Action, float, float)
[Version(2, 3, 0)]
public Coroutine InvokeRepeating(Action action, float time, float repeatTime)
Parameters
Returns
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
Returns
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
Returns
Type Parameters
T