private void OnDestroy()
 {
     if (childEditors != null)
     {
         for (int i = 0; i < childEditors.Count; i++)
         {
             childEditors[i].OnDestroy();
         }
     }
     instance = null;
     db       = null;
 }
        private void SelectDatabase()
        {
            string searchString = "Search...";

            StatConfigurations[] databases = EditorTools.FindAssets <StatConfigurations>();

            UtilityInstanceWindow.ShowWindow("Select Stat Configurations", delegate() {
                searchString = EditorTools.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"))
                {
                    StatConfigurations db = EditorTools.CreateAsset <StatConfigurations>(true);
                    if (db != null)
                    {
                        ArrayUtility.Add <StatConfigurations>(ref databases, db);
                    }
                }
                GUI.backgroundColor = color;
            });
        }