Advertisement
MrsMcLead

Making Objects based on timer

Dec 3rd, 2013
476
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Simple Instantiation of a Prefab at Start
  2. var thePrefab : GameObject;
  3. var myTimer : float = 5.0;
  4.  
  5.  
  6.  
  7. function Update () {
  8.  if(myTimer > 0){
  9.   myTimer -= Time.deltaTime;
  10.  }
  11.  if(myTimer <= 0){
  12.   var instance : GameObject = Instantiate(thePrefab, transform.position, transform.rotation);
  13.  myTimer = 5.0;
  14.  }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement