I have a simple spawn script for my 2D game that i wrote, that i want to spawn an object after a specific period of time. I managed to get this to work but the one problem is that the object keeps spawning. I just want the object to spawn once not an infinite amount.
var myTimer : float = 5.0; var thePrefab : GameObject; function Update () { if(myTimer > 0){ myTimer -= Time.deltaTime; } if(myTimer <= 0){ var instance : GameObject = Instantiate(thePrefab, transform.position, transform.rotation); } }