Quantcast
Channel: Questions in topic: "random spawn"
Viewing all articles
Browse latest Browse all 125

Instantiating object randomly withing the boundaries of an object.

$
0
0
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,??? } } }

Viewing all articles
Browse latest Browse all 125

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>