Change background of GUI.DrawTexture while in game

When my game starts i have some code which draws 2 textures that I adjust the length of to display stamina. It works perfect.

void OnGUI() {
		GUI.DrawTexture (new Rect (10, 10, curStaminaBG, barHeights), staminaBarBG);
		GUI.DrawTexture (new Rect (10, 10, displayStamina, barHeights), staminaBar);
	}

What I would like to able to do is to change the texture when say a bool is set to true. So if I take this line from the above:

GUI.DrawTexture (new Rect (10, 10, displayStamina, barHeights), staminaBar);

When my bool goes to true I want it to change to:

GUI.DrawTexture (new Rect (10, 10, displayStamina, barHeights), newBackground);

Seeing as how they are drawn in the ongui function can I even do that?

Totally just figured it out. By adding a new texture2d and just change the variable with if statements in the update function all is working now!

There’s nothing stopping you from doing it in OnGUI either.

if (someBool)
    GUI.DrawTexture(rect, tex1);
else
    GUI.DrawTexture(rect, tex2);

Perhaps I missed it in the docs, onGui is drawn every frame?

It’s run multiple times per frame based on different GUI events (input, layout, paint, etc)

Thanks for the help. I will re read the docs