Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • waitforseconds() method not work not working

    • 1
    • 1
    • 1
    • 3
    • 0
    • 0
    • 0
    • 620
    Answer it

    I wrote my codes right and based on the codes in (Unity docs)

    but still not working , not waiting , any help !

      IEnumerator wait(float waitTime)
      {
          Debug.Log("Wait"); // write this successfully
          yield return new WaitForSeconds(waitTime);
          Debug.Log("Waitting"); // not write it , not enter here !!
      }
    
      void somefunction()
      {
          StartCoroutine("wait", Resources.Load<AudioClip>("win").length);
          Debug.Log("waiting finished"); // write it directly !
      }
    

 3 Answer(s)

  • Hello,

    I have tested this code. This is working perfectly.

    The length of the audio clip is in seconds. Debug its length.
    The only thing you need to do is wait for the time(length of the audio clip in sec) and then it will print "Waitting" for sure.

    Thanks

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: