var playerObj : GameObject; var aTexture : Texture; function OnGUI () { var pivotPoint : Vector2 = Vector2(35, 35); var angleY : float = playerObj.transform.localEulerAngles.y; GUIUtility.RotateAroundPivot(angleY, pivotPoint); GUI.DrawTexture(Rect(5, 5, 60, 60), aTexture); }
http://d.hatena.ne.jp/nakamura001/
http://zi-su.blogspot.com/2011/05/guitexture.html?spref=tw
↓のScriptをGameObject>Emptyにくっつける。→Hierarchyに存在するので表示
function OnGUI () { if (GUI.Button (Rect (10,10,150,100), "I am a button")) { print ("You clicked the button!"); } }
function OnGUI () { if (GUI.Button (Rect (10,10,100,50), "Main stage")) { Application.LoadLevel ("mainstage"); } if (GUI.Button (Rect (120,10,100,50), "Killball stage")) { Application.LoadLevel ("killballstage"); } if (GUI.Button (Rect (230,10,100,50), "Spawn stage")) { Application.LoadLevel ("spawnstage"); } } //これを1つのGameObject>Emptyにくっつけると3つのボタンが表示される
■GUI シーン切替時 消えないで! function Awake () { DontDestroyOnLoad (this); }