public static UtilityInstanceWindow ShowWindow(string title, Vector2 size, Action onGUI, Action onClose)
        {
            UtilityInstanceWindow window = EditorWindow.GetWindow <UtilityInstanceWindow>(true, title);

            window.minSize = size;
            window.onGUI   = onGUI;
            window.onClose = onClose;
            return(window);
        }
        protected virtual void SelectDatabase()
        {
            string searchString = "Search...";

            T[] databases = UnityEditorUtility.FindAssets <T>();
            UtilityInstanceWindow.ShowWindow("Select Settings", delegate() {
                searchString = UnityEditorUtility.SearchField(searchString);

                for (int i = 0; i < databases.Length; i++)
                {
                    if (!string.IsNullOrEmpty(searchString) && !searchString.Equals("Search...") && !databases[i].name.Contains(searchString))
                    {
                        continue;
                    }
                    GUIStyle style = new GUIStyle("button");
                    style.wordWrap = true;
                    if (GUILayout.Button(AssetDatabase.GetAssetPath(databases[i]), style))
                    {
                        database = databases[i];
                        ResetChildEditors();
                        Show();
                        UtilityInstanceWindow.CloseWindow();
                    }
                }
                GUILayout.FlexibleSpace();
                Color color         = GUI.backgroundColor;
                GUI.backgroundColor = Color.green;
                if (GUILayout.Button("Create"))
                {
                    T db = AssetCreator.CreateAsset <T>(true);
                    if (db != null)
                    {
                        ArrayUtility.Add <T>(ref databases, db);
                    }
                }
                GUI.backgroundColor = color;
            });
        }
 private void OnEnable()
 {
     instance = this;
 }
Esempio n. 4
0
 private void OnEnable()
 {
     instance = this;
     AssemblyReloadEvents.afterAssemblyReload += OnAfterAssemblyReload;
 }