- Home /
Can CompositeCollider2D not be disabled?
I have an Object with a CompositeCollider2d that merges the colliders of several child objects (the limbs of my player). However, I need all of them to be disabled in the beginning of the game. There is no Checkbox on the CompositeCollider2d in the inspector and neither does GetComponent<CompositeCollider2d>().enabled = false;
do anything.
The documentation claims that "enabled" is an available property on CompositeCollider2d. The object has a Rigidbody2D on the same element as the CompositeCollider2d and behaves as expected everywhere else.
What is the problem?
Only the components that have a checkbox in the Inspector can be enabled/disabled. So, it seems that the documentation is wrong in this case.
As a silly workaround, if you're using it as a traditional collider, can you change it to a Trigger ins$$anonymous$$d of disabling it? That would disable actual collisions until you returned it to normal.
Another workaround would be to change the GameObject's layer to one that is set to not interact with other layers.
Answer by verity147 · Jan 31, 2018 at 10:58 AM
I guess I will change the layer to IgnoreRaycast and back, but apparently this also means the docs are wrong.
...or you could create a new layer, e.g. "IgnoreCollisions", and assign that (after unchecking all its checkboxes in the Layer Collision $$anonymous$$atrix of the Physics2DSettings).
The documentation is wrong in many instances, and we can help fix it:
either though the Unity Bug Reporter - Unity Help $$anonymous$$enu/Report a Bug... and select for "What is the problem related to": "Documentation"
or by navigating to the documentation page with the problem, and at the bottom of the page, click on the link "Report a problem on this page", and then on a link, such as "Information is incorrect".