Unity: Children colliders still active even if parent is not

I’m experiencing a weird issue where the colliders are still active/repulsing objects even if the whole parent group is not.
This happens when dynamically disabling the parent through activeSelf = false removing the parent from the scene but not altering the children (which are not rendered anymore, as expected).

EDIT: I’ve realized the issue doesn’t occur when setting activeSelf = false but when it’s been removed through object.parent.remove(object).

Original Post on Discord

by user 615280976855171083

Can you check if you still see the colliders when you add showcolliders to the url? Do you have a live link that you can share? And which version are you currently on?

I’ve just tested with the flag on, and yes the colliders are still visible ! (See edits on the original post.)

by user 615280976855171083

Ah yeah - thanks for the report. I’ll take a look - it’s a known issue because we currently havent wrapped “add” and “remove” calls in threejs. It should also work correctly if you use GameObject.add or remove (our static method calls)

Oh indeed, using the static method the colliders are gone ! However I have now plenty of center.multiply is not a function errors. :sweat_smile:
At least now I know what the problem is. I’ll only disable the parents for this case instead of removing them.
Thanks for the help ! :+1:

by user 615280976855171083

Where does the errors come from exactly?

They occur while loading the game. For each instance created of some class attached to gameObjects, I check if its gameObject is active - if not, I remove it from the scene. Maybe the engine don’t like that we directly remove objects while it loads other ones.
The goal was to improve even more the performances - not rendering objects isn’t enough for big chunks of 3D models.

by user 615280976855171083

do you think you could send a bugreport with this state? I’d love to take a closer look

Sure ! I’ll send you one later today.

by user 615280976855171083

Just to update this from our PM: this seemed to be caused by calling GameObject.add(this.gameObject, this.parentObject) where the object was already visible and parented to that object. Unfortunately the same thing doesnt reproduce here for me - and works now in this case / with removing the duplicate call