Answers for "waituntil unity"

C#
1

wait in unity

IEnumerator wait(float waitTime){ //creating a function
        yield return new WaitForSeconds(waitTime); //tell unity to wait!!
    }
    
    void Start(){
    	print("start");
        wait(1); ///using function
        print("Good night")
    }
Posted by: Guest on June-07-2021
0

unity wait until

using UnityEngine;
using System.Collections;

public class WaitUntilExample : MonoBehaviour
{
    public int frame;

    void Start()
    {
        StartCoroutine(Example());
    }

    IEnumerator Example()
    {
        Debug.Log("Waiting for princess to be rescued...");
        yield return new WaitUntil(() => frame >= 10);
        Debug.Log("Princess was rescued!");
    }

    void Update()
    {
        if (frame <= 10)
        {
            Debug.Log("Frame: " + frame);
            frame++;
        }
    }
}
Posted by: Guest on October-15-2021

C# Answers by Framework

Browse Popular Code Answers by Language