Why is my array getting filled with "missing objects"

125042-rip.pngI have a function that generates room with random assets in pre-defined places. I store those assets in arrays with “FindGameObjectsWithTag” function. When I first start the scene it works flawlessly. However, when I destroy the room and everything in it ( before generating a new one, I double checked) and call the function that generates it again, FindGameObjectsWithTag function fills arrays with objects again, but usually with a few “missing objects”. What’s causing this?

It means that the objects aren’t in the scene anymore but you’re still trying to reference to them inside the array.

Make sure to reset the int that you might be looping with in your script. Can we see your code? the problem is probably in there.

IE: if you found 5 hotspot objects, then cleared them, and then ran a loop without clearing the original int, it would start from 5.