Does anybody know the best way for me to check if a spawn point is occupied?
Basically I have a script which will spawn a pickup at a random spawn point. As it stands this will keep spawning them regardless of whether there is one there or not so I end up with multiple pickups on each spawn instead of just a single pickup.
I just need to be able to check if there is already a pickup at the spawn point if there is move to the next random location.
Replies
- Create an Collider and check if the unit is inside.
- create a bool variable and turn it to "true" when the unit/pickup spawns. When it gets picked up turn it to "false", spawn another one and turn it back to "true". Dont spawn pickups while the variable says "true".