Fold/Unfold inspector components through script

Is there a way to fold/unfold components by code? I want the collider component to be folded because I don’t want the green edges of the collider to show up.



As far as I understand you want to “disable” the collider instead of “fold/unfold” it?

If that’s the case this is what you need to do:

GetComponent<BoxCollider>().enabled = false;