Quantcast
Channel: Questions in topic: "clone"
Viewing all articles
Browse latest Browse all 508

spawning game objects

$
0
0
I have this script that spawns objects from the center of the game object, I want the script to spawn the objects randomly from the object, rather than only from the center how can i do this? [SerializeField] float secondsBetweenSpawns = 2f; [SerializeField] GameObject enemyPrefab; void Start() { StartCoroutine(SpawnBlocks()); } IEnumerator SpawnBlocks() { while (true) { Instantiate(enemyPrefab, transform.position, Quaternion.identity); yield return new WaitForSeconds(secondsBetweenSpawns); } } }

Viewing all articles
Browse latest Browse all 508

Latest Images

Trending Articles



Latest Images

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