Extra OnTriggerEnter call on deattaching

I have two objects, оne attached to another, child object has collider. This “multiobject” enters trigger, and OnTriggerEnter is called.

Now, the problem. I have functionality, which deattaches child object in certain cases. Once i deattach child object, while it is in trigger, trigger calls another OnTriggerEnter, which is pretty weird, and this messes up some of my code.

So, is that bug, feature, something else?

Sooo, any thoughts, how to deal with it.

If your child object gets deattached, it has no parent anymore, i think.
So you can add a line of code to the OnTriggerEnter() like this:

   if ( myChildObject.transform.parent == null) return;

If your child object has no parent anymore, this will just return (stop the method OnTriggerEnter) and do nothing.
For “myChildObject” you must use your child object of course. If the script is attached to this child object you can just use transform.parent.