/// <summary>
 /// Gets the attribute.
 /// </summary>
 /// <returns>The attribute.</returns>
 /// <param name="type">Type.</param>
 /// <typeparam name="T">The 1st type parameter.</typeparam>
 public static T GetAttribute <T>(this Type type)
 {
     object[] objArray = UnityEditorUtility.GetCustomAttributes(type);
     for (int i = 0; i < (int)objArray.Length; i++)
     {
         if (objArray[i].GetType() == typeof(T) || objArray[i].GetType().IsSubclassOf(typeof(T)))
         {
             return((T)objArray[i]);
         }
     }
     return(default(T));
 }
        protected virtual void SelectDatabase()
        {
            string searchString = "Search...";

            T[] databases = UnityEditorUtility.GetAssetsOfType <T>(".asset");
            UtilityWindow.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();
                        UtilityWindow.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;
            });
        }
 protected virtual void DoSearchGUI()
 {
     searchString = UnityEditorUtility.SearchField(searchString, GUILayout.Width(sidebarRect.width - 20));
 }