GUI Skin

Im using the example code in the documentation to add a custom skin:

// Create a public variable where we can assign the GUISkin
var customSkin : GUISkin;

// Apply the Skin in our OnGUI() function
function OnGUI () {
	GUI.skin = customSkin;

	// Now create any Controls you like, and they will be displayed with the custom Skin
	GUILayout.Button ("I am a re-Skinned Button");

	// You can change or remove the skin for some Controls but not others
	GUI.skin = null;

	// Any Controls created here will use the default Skin and not the custom Skin
	GUILayout.Button ("This Button uses the default UnityGUI Skin");
}

But it comes up with the error: ‘skin’ is not a member of ‘GUI’.

Any ideas whats going on?

Your script is called “GUI”, so it’s looking for a variable called “skin” in it. Change your script name.

–Eric