Destroy function that deletes the first hierarchy component without being attached to it

Is it possible to make a destroy function that removes the first hierarchy object without having the script attached to the first hierarchy object? If yes how?
I basically have a spawner that spawns cubes in the hierarchy but when I press click it destroies them all at once instead of destroying the first cube spawned in the hierarchy as a clone ( Cube(clone) )

You just need a reference to the first object. Perhaps show your misbehaving code and we can help you to see why it’s destroying them all.

I had to look up the history of posts, but sure enough I responded to your question. You said thanks a lot…I thought it was working for ya :slight_smile: