Quantcast
Channel: Answers for "A bit complicated instantiate question"
Viewing all articles
Browse latest Browse all 4

Answer by thornekey

$
0
0
like Nick4 said, you can define a list of spawn places, if you create an array and hold the spawn places in there you can randomly choose different meteor prefabs (assuming u want some uniqueness) and then randomly spawn the amount, and random range location of them. For example (this wont be 100% accurate nor complete but an outline) private bool CheckForMeteorPrefabs() { if (meteorPrefab.Length > 0) return true; else return false; } private bool CheckForSpawnPoints() { if (spawnPoints.Length > 0) return true; else return false; } //generate a list of available spawnpoints that do not have any meteors childed to it private GameObject[] AvailableSpawnPoints() { List gos = new List(); for(int cnt = 0; cnt < spawnPoints.Length; cnt++) { if (spawnPoints[cnt].transform.childCount == 0) { Debug.Log("**meteor spawn point available**"); gos.Add(spawnPoints[cnt]); } }

Viewing all articles
Browse latest Browse all 4

Trending Articles



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