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")
}
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")
}
how to delay something in c# unity
Invoke("DoSomething", 2);//this will happen after 2 seconds
unity c# run a command then wait
IEnumerator placeholder1() // weird syntax for this but its needed.
{
COODE HERE
yield return new WaitForSeconds(SECONDSHERE); //this is were the wait will happen. so position it in your func where you want to wait.
CODE HERE
} // if this returns errors its most likely because you need to include the yield return new WaitForSeconds
// if this still return errir check that you didnt clean up the tags at the top because you need the two using System.Collections; and using System.Collections.Generic; tags. So if you got rid of them just add them back.
//now we need to call the func in a void or a public void if we want to acces it outside our script.
public void placeholder2() //this can be called using a button or another scipt etc.
{
StartCoroutine(placeholder1())
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us