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. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

Updated my system OS and now I get a code error?

Discussion in 'Scripting' started by larswik, Mar 6, 2018.

  1. larswik

    larswik

    Joined:
    Dec 20, 2012
    Posts:
    312
    I don't understand this. I don't think it has to do with my system update but I am running a coroutine that calls this method below to delay a couple seconds.
    Code (CSharp):
    1.     IEnumerator waitTimeToFire(){
    2.         yield return new WaitForSeconds(2f);
    3.         calculateAttack(theWind, castleXPos);
    4.     }
    And suddenly this error pops up.
    Before coming here for help I did a search on the error message which came up often but the solutions don't seem to work? Solutions seem to imply changing NameSpaces would instantly solve this problem, it did not. Then I added a return type like
    Code (CSharp):
    1. IEnumerator<float> waitTimeToFire()
    This solved the error on that first line but pushed the problem down 1 level and gave me an invalid return type in the waitForSeconds().

    That gives me this error.
    My current name spaces are
    Code (CSharp):
    1. using System.Collections.Generic;
    2. using UnityEngine;
    3. using UnityEngine.UI;
    4. using System.Linq;
    So I am running in circles here, any ideas?
     
  2. gegebel

    gegebel

    Joined:
    Jan 29, 2014
    Posts:
    469
    try adding System.Collections
    Did happen to me. Might be a bug or whatever, but it worked.
     
    joveem_ likes this.
  3. larswik

    larswik

    Joined:
    Dec 20, 2012
    Posts:
    312
    This is so ridicules. This was one of the solutions that I tried yesterday and it didn't work. But today I tried it again and it worked. Thanks.

    I don't get it thought? I did a OS update on my Mac yesterday and then after I updated to 10.12.6, from 10.12.5 this error message popped up. Thanks!