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
objObjectThe 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
TThe 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
TThe 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
prefabGameObjectThe 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
prefabGameObjectThe prefab.
rootGameObjectThe 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
prefabGameObjectThe prefab.
rootGameObjectThe root.
localPositionVector3The local position.
localRotationQuaternionThe local rotation.
Returns
- GameObject
GameObject.
Instantiate(GameObject, Vector3, Quaternion)
Instantiates the specified prefab.
public static GameObject Instantiate(GameObject prefab, Vector3 position, Quaternion rotation)
Parameters
prefabGameObjectpositionVector3rotationQuaternion
Returns
Instantiate<T>(T)
Instantiates the specified prefab.
public static T Instantiate<T>(T prefab) where T : Component
Parameters
prefabTThe 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
prefabTrootGameObject
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
prefabTrootGameObjectlocalPositionVector3localRotationQuaternion
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
prefabTThe prefab to instantiate.
positionVector3The position.
rotationQuaternionThe 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
actionActionrepeatTimeIGenerator<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