If I have an array of 10 game objects and one of the game objects is deleted, leaving behind a missing game object for the element it was in, how do I detect what element contains a missing game object?
Sisso
2
If you compare a GameObject with null after it’s destroyed it will return true (even though it’s not really null, it’s just the ‘==’ operator that is overloaded to provide this functionality).
Something like this should do the trick:
GameObject destroyedDude;
foreach(GameObject elem in myArray) {
if(elem == null) {
destroyedDude = elem;
}
}