Well, as simply as the title states, I am looking to spawn a certain prefab, a random number of times (lets say, 0 to 2) every second.
Thus far I am able to spawn my prefab randomly every tick via the FixedUpdate function, and I also know, I think, that I should use Time.deltaTime to work over seconds / frames, but, embarrassingly I can’t figure out where or how to utilize it.
Thank you in advance for any help you guys can give!
Creation Script
#pragma strict
var newTower : Rigidbody;
private var towerCount = 0;
function Start () {}
function FixedUpdate ()
{
var towerNum = Random.Range(0,2);
for (var i = 0; i < towerNum; i++)
{
var towerSpawnPosition = Instantiate
(newTower,
Vector3
(
Random.Range(-50,50),
Random.Range(0,0),
Random.Range(180,200)
),
Quaternion.Euler
(
Random.Range(0,0),
Random.Range(0,0),
Random.Range(0,0)
)
);
Debug.Log("Tower has been built!");
towerCount++;
}
}