Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Solved: IEnumerator not working

Discussion in 'Scripting' started by Callum_Coombs, Mar 22, 2021.

  1. Callum_Coombs

    Callum_Coombs

    Joined:
    Feb 26, 2019
    Posts:
    10
    Hello! This is the first problem I have posted here. It is probably simple to fix, but I can't think of a solution.

    Below is my script:

    upload_2021-3-22_18-15-53.png

    My problem is that The Loop() in the IEnumerator Loop() line is underlined red. I have no idea what is wrong.

    This is Unity's Error with it:

    upload_2021-3-22_18-16-24.png

    Any help would be greatly appreciated as I will not be able to work on my project if it is not fixed.. If you choose to reply, please @ me (Callum_Coombs). If it is fixed, the title of the thread will be updated.
     
  2. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,637
    You Loop method must contain at least one "yield return" or "yield break" statement.
     
    Callum_Coombs likes this.
  3. Callum_Coombs

    Callum_Coombs

    Joined:
    Feb 26, 2019
    Posts:
    10
    Thanks Very Much! Have a good Time of day!