お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
CloseOnGUIはレンダリングとGUIイベントのハンドリングのために呼び出されます
これはOnGUIを実装した際には毎フレーム複数回(イベント毎に1回)呼び出されることを意味します。GUIイベントについて、詳しくはEventリファレンスを参照してください。 MonoBehaviourのenabledプロパティをfalseにした場合、OnGUI()が呼び出されることはありません。
function OnGUI () { if (GUI.Button (Rect (10,10,150,100), "I am a button")) print ("You clicked the button!"); }
using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { void OnGUI() { if (GUI.Button(new Rect(10, 10, 150, 100), "I am a button")) print("You clicked the button!"); } }
import UnityEngine import System.Collections public class ExampleClass(MonoBehaviour): def OnGUI() as void: if GUI.Button(Rect(10, 10, 150, 100), 'I am a button'): print('You clicked the button!')
詳細は、GUIスクリプティングガイドを参照してください。