The best overloaded method match for `UnityEngine.MonoBehaviour.StartCoroutine(System.Collections.IE

I am getting 2 errors with this script
//this is only part of the script the full one is much longer but this is the part with errors

the errors i am getting are:
error CS1502: The best overloaded method match for UnityEngine.MonoBehaviour.StartCoroutine(System.Collections.IEnumerator)' has some invalid arguments and error CS1503: Argument #1’ cannot convert System.Collections.IEnumerable' expression to type System.Collections.IEnumerator’

if (Input.GetKeyDown (KeyCode.Return))
        {
            if(!isTyping)
            {
                currentLine += 1;

                if (currentLine > endAtLine)
                {
                    DisableTextBox();
                }
                else
                {
                    StartCoroutine(TextScroll(textLines[currentLine]));
                }
            }
            else if(isTyping && !cancelTyping)
            {
                cancelTyping = true;
            }
        }

If anyone could help it would be greatly appreciated

whatever function ‘TextScroll’ is returns an IEnumerable, rather than an IEnumerator.

Either you need to change the return type to IEnumerator (if you can).

Or call ‘GetEnumerator’ at the end of TextScroll(…)

StartCoroutine(TextScroll(textLines[currentLine]).GetEnumerator());
1 Like

Thanks for the quick and exact reply!
That fixed the error thanks so much!!

Make sure the return type for your Coroutine is of type IEnumerator and not IEnumerable. Check the spelling, its a small spelling mistake.