Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • IEnumerator

    • 0
    • 3
    • 3
    • 1
    • 0
    • 0
    • 0
    • 0
    • 342
    Comment on it

    What is IEnumerators ?

    IEnumerators are used to allow a program to yield things like the WaitForSeconds function, which tells the script to wait without hogging the CPU.

    StartCoRoutine essentially runs a function in another thread when used with yield. The execution of a coroutine can be paused at any point using the yield statement. The yield returns a value specifies when the coroutine is resumed.

    Example : In this example CPU will wait for 5 seconds and after that "This is the use of IEnumerator..." will be printed.

     public void function()
        {
            StartCoroutine (timing());               
        }
        IEnumerator timing()
        {
            yield return new WaitForSeconds (5.0f);
            Debug.Log("This is the use of IEnumerator...");
        }
    

 0 Comment(s)

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: