Child blocking a Destroy call on a parent?

Under what circumstances will a child object block the destroy call on a parent?

I have some code which has been working fine until I added a script to an underlying child, which is only updating it’s own position and scale, but now the parent destroy command does nothing.

The destroy command is already a workaround, because there is a particle system started at the same time I have to set a timer flag and destroy the object by checking that flag in the following updates, in the mean time the object is moved out of the scene.

As I say, this was all working fine until I put code on the child. Rather than go through the hell of taking out a line of code at a time and waiting 20 seconds for the thing to compile I thought I’d ask here!

Many thanks.

Under no circumstances will the Destroy be “blocked”. Something else is going on. Maybe you are calling destroy on the wrong object by accident?

1 Like

Under no circumstances.

Instead of your troubleshooting method, I’d instead immediately before the Destroy call add a Debug.Log line which includes the GameObject.name of the GameObject you are about to destroy. Then run your game, and verify:

  1. The correct object appears in the console as the one to be destroyed
  2. That no console errors appear
  3. That in later frames the object is or is not destroyed

If you’re still having trouble, I suggest posting the script here using CODE tags.