Embed GUI Skin in GUI Button

Ok, I have a GUI Button that I need to be a specific skin. The docs say that I can tell Unity what skin to use when I declare the button:

“static function Button (position : Rect, text : String, style : GUIStyle) : boolean”

So I do that:

if(GUI.Button(Rect(10, 10, 196, 64), "Main", scoreBoxTabs))

scoreBoxTabs is a GUISkin variable that has a GUI Skin assigned.

The problem is, Unity keeps giving me the error:

“Assets/Scripts/GameGUI.js(189,30): BCE0023: No appropriate version of ‘UnityEngine.GUI.Button’ for the argument list ‘(UnityEngine.Rect, String, UnityEngine.GUISkin)’ was found.”

What am I doing wrong?

You use a GUISkin, not a GUIStyle.

Try :

if(GUI.Button(Rect(10, 10, 196, 64), "Main", scoreBoxTabs.button))

The usual way is to use style-names from the current active skin. To make a skin active you have to assign it to GUI.skin before you draw your button:

var scoreBoxTabs : GUISkin;
function OnGUI()
    GUI.skin = scoreBoxTabs;
    if(GUI.Button(Rect(10, 10, 196, 64), "Main")) // uses the default button style from scoreBoxTabs
    if(GUI.Button(Rect(10, 10, 196, 64), "Main", "MyCustomStyle")) // uses the style named MyCustomStyle from scoreBoxTabs

Keep in mind you can add as many GUIStyles as you want to the customstyles array of the skin.