Click On GUI.Label

Is there any possibility to catch an OnClick event in a GUI.Label?

You could utilize the Rect used for specifying GUI.Label position/dimensions to check whether the mouse pointer is hovering over your label, then check if user has pressed a mouse button.

Just use a GUI.Button that is drawn in the Label style.

i.e.

if( GUI.Button("My clickable label", "Label" ) )
{
  Debug.Log("You clicked my label!");
}
3 Likes