How Do I Make GUI ON Off Button with 2 Button States

OK I have a button with 2 states one one button is not lighted
2nd button state is lighted.
So when you click the button it swaps out the GUI button image for the lighted one and when clicked again it swaps it back to the un lighted button.
Seems simple enough but I can’t find a working sample of how this is done anywhere,

if (GUI.Button (Rect (20,40,80,20), “Click”)) {
ButtonToggle();
}

set up a boolean. on button click call a function.

private bool isClicked = false;

void ButtonToggle(){
   if(isClicked){
      isClicked = false;
      //swap texture to OFF
   }else{
      isClicked = true;
      //swap texture to ON
   }
}

Triggering between states is as easy as using simple bool.

private bool state = false;

private void Update(){
    if (Input.GetButtonDown("Fire1")){
        state = !state;

        if(state) Debug.Log("ON");
        else Debug.Log("OFF");
    }
}

The rest is up to you how you visually represent it. I’d suggest using 4.6 UI if your not familiar with OnGUI().

Sounds like you could just use GUI.Toggle.

if(GUI.Toggle(yourRect, yourToggleBool, "buttonName") != yourToggleBool) {
			Event.current.Use();
			
			yourToggleBool = !yourToggleBool;
			return;
		}

You can pass it a custom GUI style of your liking that has the proper button on/off images as it’s Toggle style.