I’m creating GameObject and adding MonoBehaviour to it.
go = new GameObject("sprite" + creepId);
mb = go.AddComponent<MonoBehaviour>();
Then I’m using mb to start coroutine
mb.StartCoroutine("coMove", new MoveData(Utils.ToVector2(go.transform.position), destPositions));
At run time I get Exception:
Coroutine 'coMove' couldn't be started!
UnityEngine.MonoBehaviour:StartCoroutine(String, Object)
JATD.Creep`1:Move(Vector2[]) (at Assets/JATD/Scripts/Creep.cs:68)
<Spawner>c__Iterator2:MoveNext() (at Assets/JATD/Scripts/MainGame.cs:103)
Any thoughts?
P.S. .NET 4.0 is set in the MonoDevelop project settings.
Oddly string names in some circumstances do actually fire this error. Seems safer to avoid string names whenever possible.
– Ash-Blue