Gui Label Click please help

foreach (string item in result) {
GUILayout.Label(item, GUI.skin.box, GUILayout.ExpandWidth(true));
}

Hi When you writing code for Gui like this. How do you make the label text clickable and then return the value of the label to your function? I would like to click a scrollable menu with text.

You’ll have to use GUILayoutUtility.GetRect to get the rect, then use GUI.Label with that rect. From there you can manually check to see whether the user has clicked in that rect.

Thanks but I dont understand how to apply to my code and get the label text returned which is dynamic.