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.

Thanks!

Alex

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;

https://forum.unity3d.com/threads/is-it-possible-to-fold-a-component-from-script-inspector-view.296333/#post-2677568