Spawning random pickups (from Array) into randomly chosen spawn positions (also from an array) and preventing pickups from spawning on top of each other.
I have a set of pickup generating emitters that will emit pickups when the user collides with the emitter. The emitter is a prefab, and is instantiated when the player activates the level. There's 3 of them in the level.
Each emitter can spawn 10 pickup items, and has 5 child objects that are transforms for the pickup to spawn on to.
Currently multiple pickups are appearing on a single spawn location. I would like them to only spawn into an empty spot. I've tried using trigger collisions so that a spawn location becomes inactive when a pickup collides with it as it's spawned in. When the pickup is collected by the player, I was planing to reactivate the associated spawn point.
Any pointers? Is there an obvious way to activate/deactivate specific entries within an array?
Thanks in advance!
[1]: /storage/temp/113040-pickupspawnarrays.jpg
Your answer
Follow this Question
Related Questions
How to spawn objects on a list of Transforms ? 2 Answers
Spawn Random Object script spawns too much 1 Answer
how to not repeat random array 1 Answer