Skip to content

Instantly share code, notes, and snippets.

@James-Frowen
Last active March 25, 2019 16:04
Show Gist options
  • Save James-Frowen/e4db3c0a281412ace6ca1c6462113bf0 to your computer and use it in GitHub Desktop.
Save James-Frowen/e4db3c0a281412ace6ca1c6462113bf0 to your computer and use it in GitHub Desktop.
Interface including useful methods of MonoBehaviour
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public interface IMonoBehaviour
{
// Object
string name { get; }
// Component
GameObject gameObject { get; }
Transform transform { get; }
T GetComponent<T>();
T GetComponentInChildren<T>(bool includeInactive = false);
T GetComponentInChildren<T>();
T GetComponentInParent<T>();
T[] GetComponents<T>();
void GetComponents<T>(List<T> results);
void GetComponentsInChildren<T>(List<T> results);
T[] GetComponentsInChildren<T>(bool includeInactive);
void GetComponentsInChildren<T>(bool includeInactive, List<T> result);
T[] GetComponentsInChildren<T>();
T[] GetComponentsInParent<T>();
T[] GetComponentsInParent<T>(bool includeInactive);
void GetComponentsInParent<T>(bool includeInactive, List<T> results);
// Behaviour
bool enabled { get; set; }
bool isActiveAndEnabled { get; }
// MonoBehaviour
Coroutine StartCoroutine(IEnumerator routine);
void StopAllCoroutines();
void StopCoroutine(IEnumerator routine);
void StopCoroutine(Coroutine routine);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment