Search Unity

Can Unity throw an error when I start a coroutine without StartCoroutine?

Discussion in 'Scripting' started by _eternal, Sep 15, 2016.

  1. _eternal

    _eternal

    Joined:
    Nov 25, 2014
    Posts:
    304
    Sometimes I accidentally try to call an IEnumerator without the StartCoroutine method, but Unity doesn't alert you when this happens. Usually it takes a few runs through the code before I realize my mistake.

    I'm not sure what goes on under the hood when you try to call an IEnumerator by its name rather than through StartCoroutine. Is there any way to print something or throw an error when this happens, just so I know what to look for?