switching between 2 states

private var change: int = 0;

function Start () {

}

function Update () {

	Debug.Log (change);

if(Input.GetButtonDown("Jump"))
{


	if (change < 1)change ++;
	else change = 0;
}

if (change == 0){

	if(tag=="Black")renderer.enabled = false;
	if(tag=="White")renderer.enabled = true;

		}
if (change == 1)
{
	if(tag=="Black")renderer.enabled = true;
	if(tag=="White")renderer.enabled = false;

	}
}

What I am trying to do is have a player switch between two different sets of platforms on the press of the space bar. The problem I have is the collider is still there when the platform render is off. What I think I need to do is turn the gameobjects on and off from a separate gameobject.

For 2 states, you can use single boolean.

private var toogle : boolean = false;

function Update(){
    if(Input.GetButtonDown("Jump")){
        toogle = !toogle;
        ChangeState();
    }
}

function ChangeState(){
    if (toogle){
        if(tag=="Black")renderer.enabled = false;
        else renderer.enabled = true;
    }

    else{
        if(tag=="Black")renderer.enabled = true;
        else renderer.enabled = false;
    }
}

The best way to handle this ended up being gameobject.setactive = true

Thanks for the help