Why does one GUI change affect every GUI on scene? How can I fix that?

I have this chunk of code:

if(mainCam.transform.position == new Vector3(1866, 1, -72.4901f)) { 
		
		
			GUI.contentColor = Color.red; 
			GUI.Label (new Rect(20,20,170,30),  "Selecting a stripe is required");
		
			//stripe 1 toggle
			toggleTxt = GUI.Toggle(new Rect(300, 85, 100, 30), toggleTxt, "");
		
			toggleTxt = GUI.Toggle(new Rect(300, 140, 100, 30), toggleTxt, "");
		
			toggleTxt = GUI.Toggle(new Rect(300, 185, 100, 30), toggleTxt, "");
		
			toggleTxt = GUI.Toggle(new Rect(300, 230, 100, 30), toggleTxt, "");
		
			toggleTxt = GUI.Toggle(new Rect(300, 275, 100, 30), toggleTxt, "");
		
			toggleTxt = GUI.Toggle(new Rect(300, 335, 100, 30), toggleTxt, "");
		
			//stripe 7
			toggleTxt = GUI.Toggle(new Rect(300, 380, 100, 30), toggleTxt, "");
		
    			
			
			if(GUI.Button (new Rect (5,Screen.height-40,170,30), "Back")) {
				print ("You clicked the button!");
				mainCam.transform.position= new Vector3(0, 1, -10);
				Camera.main.orthographicSize = 500f;	
		}
	}

I only one the text portion that says “Selecting a stripe is required” in red but I’m not sure how to individualize it for one label? When I change the color of the label, it changes the color of the text for all text on the screen. So now all my labels are red when I only want one label to be red.

Also, I noticed the same thing happen for GUI.toggle feature. I created 7 toggles so that they can be next to a game object for “selecting”. However, I want all the toggles to be tied together, so that only one toggle can be selected at a time. Right now, if I select one toggle, all the other toggles are selected as true. If I don’t select a toggle, all the other toggles are unselected. I only want to be change to move down the toggles and have them turn on and off (but only one selection in this grid of toggles).

It seems like this problem happens with all the GUI elements. How do I isolate the commands?

Thanks in advance!

This is all written in C#. If a solution is in JS, I can try and translate it into C# :slight_smile:

EDIT: I figured out how to do the toggle from this post: Using GUIToggle to on/off buttons! - Unity Answers

How about saving and restoring the color:

Color savedColor = GUI.contentColor;
GUI.contentColor = Color.red; 
GUI.Label (new Rect(20,20,170,30),  "Selecting a stripe is required");
GUI.contentColor = savedColor;