How do you enable/disable colliders of specific child gameobjects? {java}

I’m running a test where a gameObject is changing sprites from a box to a skateboard to test changing colliders. So far, I’ve created two empty child gameobjects with colliders corresponding to the two sprites’ shapes {one box collider, & one polygon collider}. What I’m trying to do is enable one collider & disable the other whenever I want to switch between the two, but none of the answers I’ve found so far have worked. Closest I’ve gotten with the fewest errors is this:

gameObject.Find("boxCol").GetComponent.BoxCollider().Enabled = true;
		gameObject.Find("skakteCol").GetComponent.PolygonCollider().Enabled = false;

Any help is much appreciated

you are not using correct syntax for finding gameObject. The GameObject which you are trying to find make sure is active in hierarchy then disable.
For more information go to link

#pragma strict
    function Start () {
            var BoxCol:
            BoxCollider = gameObject.Find("boxCol").gameObject.GetComponent. < BoxCollider > ();
        BoxCol.enabled  = false;

You’re dong everything right, just need to add a condition for a switch:

var usingSkateboard: boolean;
var switchCollider: boolean;

          switchCollider = false;
          usingSkateboard = !usingSkateboard;
          gameObject.Find("boxCol").GetComponent.<BoxCollider>().enabled = true;
          gameObject.Find("skakteCol").GetComponent.<PolygonCollider>().enabled = false;
else if(!usingSkateboard)
          gameObject.Find("boxCol").GetComponent.<BoxCollider>().enabled = false;
          gameObject.Find("skakteCol").GetComponent.<PolygonCollider>().enabled = true;

And then the only thing you need is to tick that switchCollider thing.