playMaker

Author Topic: Enabling Collider 2D on children  (Read 90 times)

Broken Stylus

  • Beta Group
  • Hero Member
  • *
  • Posts: 784
Enabling Collider 2D on children
« on: September 19, 2024, 08:29:27 AM »
The action EnableCollider2D seems to have a bizarre behavior on the children and fails to execute properly when some children (GameObjects) are deactivated. Depending on whether a child is active or not, its collider 2D component will ignore the action hosted in its parent's FSM.
In this case, the parent and some of the children have a collider 2D and it's a box.

To solve this I had to duplicate the action and specifically target each child instead, which is tedious, yet fortunately doable because my parent's content in terms of GameObjects is fairly light.

I also found that to have all the colliders of a same type to be enabled or disabled required selecting both "include children" and "all colliders", even if they're actually of the same type, instead of just using "include children".

So maybe I messed up but it seems these collider enabling actions may need a bit of a check up when it comes to centrally controlling colliders on children.