Just as the title says, Instantiate is only spawning an object at a single position. No matter what values I change. Here’s my code:
// Spawns objects at current location \\
var time : int = 5;
var randomLocationVertical : float = 15;
var randomLocationHorizontal : float = 10;
var randomLocation : Vector3;
var object : GameObject;
var object2 : GameObject;
private var countTime : float = 0;
function Update () {
countTime += Time.deltaTime;
randomLocation = Vector3(Random.Range(randomLocationHorizontal-5, randomLocationHorizontal), Random.Range(randomLocationVertical-5, randomLocationVertical), 0);
if(countTime >= time) {
Debug.Log(transform.position);
Instantiate (object, transform.position + randomLocation , Quaternion.identity);
countTime = 0;
}
}