- Do not make every class a MonoBehaviour. Static classes with initializers or Singletons are also perfectly reasonable too! Just ask yourself if the given class needs an update every frame.
- GetComponent is not a quick lookup. Try to limit its use. (Script Optimizations)
- If you do have non-UI MonoBehaviour objects (and you probably do) useGUILayout should be false. Learn about it.
- If you make a class a MonoBehaviour solely to be capable of running Coroutines consider this alternative: Have a centralized MonoBehaviour be responsible for starting Coroutines in your non-MonoBehaviours.
public delegate IEnumerator CoroutineMethod();
IEnumerator RunCoroutine(CoroutineMethod coroutineMethod)
{
return coroutineMethod();
}
public void StartCoroutineDelegate(CoroutineMethod coroutineMethod)
{
StartCoroutine("RunCoroutine", coroutineMethod);
}
Be sure to read about StartCoroutine and StopCoroutine to learn more!