I just spent the last two hours searching for different ways to implement textures as buttons. There are many, many different ways of doing it. The solution I choose is not on these forums (or at least I couldn’t find it), so I’m posting it here:
Summary:
Create a GUI.Button that will appear as just a texture. This is accomplished by stripping the clear border that normally appears around buttons.
Steps to implement:
- Create a GUISkin, then find the Button section. Set all values in the following sections to zero: Border, Padding, and Margin.
- In OnGUI(), set the GUI.skin as the skin you created. ((OR, if needed, you can set the style in the individual buttons.))
- Create a GUI.Button with this definition from the GUI.Button Scripting Reference:
static function Button (position : Rect, image : Texture, style : GUIStyle) : bool