StartCoroutine namespace or type not found

Hello, everyone. I’m currently having an issue where I’m trying to call a Coroutine, but I get a namespace not found error on the StartCoroutine method. I have been able to call this method elsewhere in the project. My class declaration is as follows:

    public class  ModelTreeBuilder  : MonoBehaviour {
   	public static IEnumerator CreateModelTree()     {     //call to StartCoroutine is made in here    }
}

And my includes are:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

Please let me know what I’ve missed.

StartCoroutine is an instance method of the MonoBehaviour class. So of course you can’t use it inside a static method without providing a MonoBehaviour instance.

You haven’t provided much context. The obvious change would be to remove the static keyword.

Good day.

This kind of errorse sometimes happens if the name of the method is not the same, or if you have some structure error , for missing some { } or some ( ) or maybe one additional innecessary { or } or ( …

Check it.

Bye!