Game Development Reference
In-Depth Information
To demonstrate, click on the Create button in the project folder view and select
GUISkin , which will give you a new GUISkin asset in the project view. By selecting
it, you will see the following window in Inspector :
As you can see, it contains all the options for altering the style globally for each
control. To use GUISkin , create a new script called GUISkins , then replace its
contents with the following:
using UnityEngine;
[ExecuteInEditMode]
public class GUISkins : MonoBehaviour {
public GUISkin MySkin;
void OnGUI()
{
GUI.skin = mySkin;
GUI.Label(new Rect(25, 15, 100, 30), "Label");
//Draw the rest of your controls
}
}
Then attach the GUISkins script to Main Camera in your current scene
(disabling any other scripts currently attached) and drag the GUISkin you
have created and apply it to the My Skin property of the script in the inspector.
 
Search WWH ::




Custom Search