http://prntscr.com/fi8odo
Im trying to spawn an object called Asteroid in a random location within the boundaries of the green area with an interval. I can't figure out what i'm supposed to write in the Instantiation code. Could someone please help me?
public class SpawnerScript : MonoBehaviour {
public float SpawnRate = 3;
private float NextSpawn;
public GameObject Asteroid;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (Time.time > NextSpawn)
{
NextSpawn = Time.time + SpawnRate;
Instantiate(Asteroid,???
}
}
}
↧