/// <summary> /// インスペクタを表示. /// </summary> void OnGUI() { Initialize(); // カタログアセットを取得/作成 catalog = catalog ?? AssetDatabase.FindAssets("t:" + typeof(SymbolCatalog).Name) .Select(x => AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(x), typeof(SymbolCatalog)) as SymbolCatalog) .FirstOrDefault() ?? CreateCatalog(); //変更チェック.PlayerSettingsなどで直接変えた場合も検知. string define = PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup); if (currentDefine != define) { currentDefine = define; catalog.Revert(); } using (var svs = new EditorGUILayout.ScrollViewScope(scrollPosition)) { scrollPosition = svs.scrollPosition; // GUILayout.Label(new GUIContent(" Available Script Symbol Define", EditorGUIUtility.ObjectContent(catalog, typeof(SymbolCatalog)).image), styleTitle); //シンボルリスト表示. ro.list = catalog.list; ro.DoLayoutList(); using (new EditorGUILayout.HorizontalScope()) { GUILayout.FlexibleSpace(); //Applyボタン. PlayerSettingsのDefineSymbolに適用. using (new EditorGUI.DisabledGroupScope(EditorApplication.isCompiling)) { if (GUILayout.Button(contentApply, GUILayout.Width(57))) { catalog.Apply(); } } } } //コンパイル中. if (EditorApplication.isCompiling) { Repaint(); } }