Skip to content

Instantly share code, notes, and snippets.

@sokuhatiku
Last active February 7, 2017 06:29
Show Gist options
  • Save sokuhatiku/1f2fa8027dcf80e8d70ad9e36cb6eed6 to your computer and use it in GitHub Desktop.
Save sokuhatiku/1f2fa8027dcf80e8d70ad9e36cb6eed6 to your computer and use it in GitHub Desktop.
description of code of create "Script" field
EditorGUI.BeginDisabledGroup(true); // ここからEndDisabledGroup()までの間にあるフィールドの値変更を禁止(trueで有効になる)
EditorGUILayout.ObjectField( // Objectを参照出来るフィールドを設置する関数
"Script", // フィールド名
MonoScript.FromMonoBehaviour((MonoBehaviour)target) , // 今回の要、MonoScriptオブジェクトを取得する
typeof(MonoScript), // Fieldが利用出来る型を制限する
false); // Hierarchyにあるオブジェクトを選択できるかどうか(今回は禁止)
EditorGUI.EndDisabledGroup(); // 値変更禁止エリア ここまで
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment