prefab time delay
Hi there. I'm still relatively new to unity and coding in general. What I hoped was to have a flare prefab in my project that starts 30 seconds in, rather than on play. I tried using a code that I found on a previous forum but it hasn't seemed to work. Any help would be mutely appreciated: using UnityEngine; using System.Collections;
IEnumerator Start () { //Wait for 14 secs
yield return new WaitForSeconds (30);
 //Turn My game object that is set to false(off) to True(on).
 ParticleSystem.Find ("Flare") .SetActive (true);
 
 //Turn the Game Oject back off after 1 sec.
 yield return new WaitForSeconds (20);
 
 //Game object will turn off
 ParticleSystem.Find ("Flare") .SetActive (false);
} }
               Comment
              
 
               
              Answer by andrew-lukasik · Jan 24, 2016 at 11:19 PM
     void Start () {
         StartCoroutine( DoStuff() );
     }
 
     IEnumerator DoStuff () {
         yield return new WaitForSeconds( 30 );
         /*stuff happening*/
     }
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                