Hiya, I have a static function issue/ IEnumerator issue. I have a static function called RegisterSelection:
public static void RegisterSelection (GameObject objectToRegister)
{
//code
StartCoroutine ( MoveAndCheckForMatch () );
}
…within this function I"m trying to execute StartCoroutine called MoveAndCheckForMatch as you can see.
private IEnumerator MoveAndCheckForMatch ()
{
//code
}
And I guess you know what’s coming. Initially the compiler was complaining that 'an object reference is required to access non-static member SphereController.MoveAndCheckForMatch etc etc I understand this to be the case, as coroutines can only run on instances of monobehaviours
SphereController is attached to a gameobject in the world, so after reading the forums I tried to get access to an instance of the script:
instanceReference = GameObject.Find("Controller").GetComponent<SphereController>();
and tried to change how I’m calling the coroutine to
instanceReference.StartCoroutine ( MoveAndCheckForMatch () );
However I’m still getting the same issue. I know this is a commonly asked question on the forums, but I understood that i was following the suggested solution, but I’m clearly messing up somewhere!
Thanks in advance for any assistance.