GameObject exist after Destroy()?

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!

1 Answer

1

From Unity reference manual:

Actual object destruction is always
delayed until after the current Update
loop, but will always be done before
rendering.

Comment removed because author had no idea what he was talking about

You're completely wrong there. ;)

Though I might be wrong. Will remove the comment.

@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

If you don't mind a slight delay you can always do a coroutine and yield return null to wait for the next frame