Quantcast
Viewing latest article 2
Browse Latest Browse All 4

Answer by CorruptedTNC

You can set your button (or any other GUI element) to have "GUIContent" when you create it in OnGUI(). In one of my projects I have this: if(GUILayout.Button (new GUIContent(obj.name, string.Format("Name: {0}\nCost: {1}\n{2}", po.Name, po.Cost, po.Description))) And then later on I pull the information for a tooltip style menu item: GUI.Label(new Rect(Input.mousePosition.x + 15, Screen.height - Input.mousePosition.y, 200, 100), GUI.tooltip); While this may not be exactly what you want, you can store whatever information you like in there. It may not be the most elegant solution but you could store an ID, name and value in the tooltip like so: if(GUILayout.Button(new GUIContent("1|start|false"))) and then later on get that information and split it using the character '|' like so: string[] info = GUI.Tooltip.Split('|'); and from there convert it to whatever type you want.

Viewing latest article 2
Browse Latest Browse All 4

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>