GUISkin
Project内で右クリック>createからGUISkinを作成しインスペクタから指定する。 作成したGUISkinで変更したい箇所のパラメータを変える。
using System.Collections; using System.Collections.Generic; using UnityEngine; public class GUITest : MonoBehaviour { public GUISkin skin; public float sliderValue=0; void OnGUI(){ GUI.skin = skin;//skin設定 GUI.Label (new Rect (50, 50, 50, 50),"Hello"); GUI.Button(new Rect(50, 100, 50, 20),"World"); sliderValue = GUI.HorizontalSlider( new Rect(350, 350, 100, 10), sliderValue, 0.0F, 10.0F ); } }
GUIStyle
個別にインスペクタから指定したいとき
public GUIStyle textStyle; void OnGUI(){ GUI.Label (new Rect (50, 50, 50, 50),"Hello", textStyle); }