Skip to content

Instantly share code, notes, and snippets.

@maco1028
Created May 7, 2017 09:01
Show Gist options
  • Save maco1028/a75e5576d7b06368556f5310a1986f92 to your computer and use it in GitHub Desktop.
Save maco1028/a75e5576d7b06368556f5310a1986f92 to your computer and use it in GitHub Desktop.
ScriptをON OFF
// ボタンの設定
function OnGUI () {
// バッググラウンドと名前設定
GUI.Box (Rect (10,10,100,90), "メニュー");
// ボタンの位置と名前設定
if (GUI.Button (Rect (20,40,80,20), "Script ON")) {
// ボタン押した時に実行したいもの
GetComponent(スクリプト名).enabled = true;
}
if (GUI.Button (Rect (20,70,80,20), "Script OFF")) {
GetComponent(スクリプト名).enabled = false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment