Answers for "unity ienumerator waitforseconds"

C#
15

Time delay C# unity

void start()
StartCoroutine(Text());

IEnumerator Text()  //  <-  its a standalone method
{
	Debug.Log("Hello")
    yield return new WaitForSeconds(3)
    Debug.Log("ByeBye")
}
Posted by: Guest on March-07-2020
6

waitforseconds unity IEnumerator

void Start()
    {
        //Start the coroutine we define below named ExampleCoroutine.
        StartCoroutine(ExampleCoroutine());
    }

    IEnumerator ExampleCoroutine()
    {
        //Print the time of when the function is first called.
        Debug.Log("Started Coroutine at timestamp : " + Time.time);

        //yield on a new YieldInstruction that waits for 5 seconds.
        yield return new WaitForSeconds(5);

        //After we have waited 5 seconds print the time again.
        Debug.Log("Finished Coroutine at timestamp : " + Time.time);
    }
Posted by: Guest on December-24-2020
6

waitforseconds unity

public void GameOver()
		{
			//Set levelText to display number of levels passed and game over message
			levelText.text = "After " + level + " months, you starved.";

			new WaitForSeconds(6);

			Application.Quit();


		}
Posted by: Guest on June-05-2020

C# Answers by Framework

Browse Popular Code Answers by Language