- Home /
 
Wait for seconds question
I want to use a wait for seconds here or some sort of time delay and then make the image inactive but I can't?
 public void ShowImage09()
     {
         image09.SetActive(!image09.active);
 
     }
 
              Answer by Onithec4t · Nov 26, 2015 at 03:41 PM
 public float time;
 
  public void ShowImage09()
          {
 
           StartCoroutine(ShowImage09_CR());
      
          }
     
      IEnumerator ShowImage09_CR()
          {
              yield return new WaitForSeconds(time);
              image09.SetActive(!image09.active);
      
          }
 
              Thanks Onithec4t that did the trick $$anonymous$$uch obliged :D
How about if i want to wait for second to Load NextLevel but with bool ? Where do i should put the IEnumerator?
public void Gotolayout2 () { if (Cannotclick == true) { sound.Play (); Application.LoadLevel (2); Popup.poen = 0; pritsel3 = 1.0f; Popup.layout += 1; } }
@Nisa_11 I'm not sure if this is what you are looking for not being very familiar with the code myself but it sounds like it:
 public void  GoSurveillance(){
         StartCoroutine(LoadT1("Surveillance$$anonymous$$odeScreen"));
     }
     
     IEnumerator LoadT1(string level01){
         yield return new WaitForSeconds(0.5f); // wait time
         Application.LoadLevel(level01);
         
     }
                  Your answer
 
             Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
check alpha of gameObject C# 3 Answers
C# simple delay execution without coroutine? 2 Answers
Waiting for fractions of a Second 1 Answer