Created
December 8, 2013 11:09
-
-
Save baba-s/7855979 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using UnityEditor; | |
using UnityEngine; | |
/// <summary> | |
/// ディレクティブ一覧の拡張ウィンドウ | |
/// </summary> | |
public class DirectiveSheet : EditorWindow | |
{ | |
private Vector2 _scrollPos; // スクロールの座標 | |
/// <summary> | |
/// ディレクティブ一覧の拡張ウィンドウを開く | |
/// </summary> | |
[MenuItem("Tools/Check/Directive Sheet")] | |
private static void Init() | |
{ | |
GetWindow<DirectiveSheet>("Directive Sheet"); | |
} | |
/// <summary> | |
/// ディレクティブ一覧の拡張ウィンドウを表示する | |
/// </summary> | |
private void OnGUI() | |
{ | |
EditorGUILayout.BeginVertical(); | |
// スクロール可能なビューを作成する | |
_scrollPos = EditorGUILayout.BeginScrollView(_scrollPos, GUILayout.Height(position.height)); | |
// 有効なディレクティブを取得する | |
var defines = EditorUserBuildSettings.activeScriptCompilationDefines; | |
// 有効なディレクティブをソートする | |
Array.Sort(defines); | |
// 有効なディレクティブを表示する | |
foreach (var define in defines) | |
{ | |
EditorGUILayout.SelectableLabel(define, GUILayout.Height(16)); | |
} | |
EditorGUILayout.EndScrollView(); | |
EditorGUILayout.EndVertical(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment