I think my question is clear, I have one gameobject with the name testObject and this is my code:
GameObject[] allChildren = GameObject.FindGameObjectsWithTag("Respawn");
for(int i = 0; i < allChildren.Length; i++){
Destroy(allChildren*.gameObject);*
if(allChildren != null){
print ("Destroying " + allChildren*.name);*
}
* }*
The result is “Destroying testObject” what I don’t understand because I have destroyed the GameObject. Any help is appreciated!
Comment removed because author had no idea what he was talking about
– KiwasiYou're completely wrong there. ;)
– Eric5h5Though I might be wrong. Will remove the comment.
– Kiwasi@mwbranna wow I really didn't know that! Thank you for helping me, I think I will find a way around this problem now :P
– F-NIf you don't mind a slight delay you can always do a coroutine and yield return null to wait for the next frame
– Kiwasi