This is my inventory screen. To display items I use buttons with
asked Aug 13 '11 at 08:21 PM
Buttons are far too simple for what you're trying to do. I can't say I'm any expert at GUI, but you probably want to create a GUI Group (see GUI.BeginGroup) and then layout your group as you wish. To make it 'clickable', what I would do is, within the OnGUI() function, do something like:
answered Aug 13 '11 at 08:48 PM
I don't want to encourage people to dig to deep into foreign code, but i guess the UnityEngine.dll is not a big secret since it's all managed code ;). ILSpy gives me this:
As you can see the magic behind the GUI.Button function is not black-magic. The whole GUI system is build on top of styles. Styles are almost the only things that can be drawn in the GUI system. A GUIStyle supports only 1 background image, 1 content image and the content-text. More complex GUI-elements like a Scrollview for example uses multiple styles. Each scrollbar uses 4 different styles (background, up-button, down-button, thumb). Those more complex elements just uses other simpler elements internally.
You can build more complex functions on your own. The GUI system is that simple to provide the best extensibility.
You can learn a lot about the GUI system by using ILSpy or any other .NET reflector.
answered Aug 13 '11 at 11:28 PM