Highlight a gui component

I have a list of buttons that look like labels, and I want to be able to highlight the one you have selected.

how do I set the gui state of the object being drawn? and will it work on the label style?

thanks.

currently this is what I have.

scrollPos = GUILayout.BeginScrollView(scrollPos);
foreach(location loc in locations)
{
	if(GUILayout.Button(loc.getName(), GUI.skin.GetStyle("label")))
	{
		Debug.Log(loc.getName());
	}
}
GUILayout.EndScrollView();

Ok basically I want to specify what state a Gui element is in, so I can use the style set in the skin.

If it was a Button how would I do that?

I’m looking for something like

GUILayout.Button("Name", GUI.skin.GetSytle("button.active"))

or

GUILayout.Button("Name", GUI.skin.GetSytle("button").active)

Thanks

bump

You will need to call SetNextControlName() before you create each control, thereby providing a name that you can later pass to a call to the GUI.FocusControl() method.

You’ll probably want to create a class or struct to hold the locations and control names, so that you can still build the controls in your loop.

Hope that helps.