I have 2 classes.
public class GameManager : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        var a = new Routine();
        a.StartRoutine();
    }
}
public class Routine : MonoBehaviour
{
    public void StartRoutine()
    {
        StartCoroutine(test());
    }
    IEnumerator test(){
        Debug.Log("MSG");
        yield return null;
    }
}
I put GameManager on Camera, run game and get NullReferenceException
NullReferenceException
UnityEngine.MonoBehaviour.StartCoroutine (System.Collections.IEnumerator routine) (at <d815b7efac424eeb8e053965cccb1f98>:0)
Routine..ctor () (at Assets/Routine.cs:9)
GameManager.Start () (at Assets/GameManager.cs:10)
So what is wrong with this code?
 
    