Exemplo n.º 1
0
        void OpenFolderCreator()
        {
            string absPath = EditorUtility.OpenFilePanel("Select a Folder List", "", "");
            string relPath = absPath;

            if (absPath.StartsWith(Application.dataPath))
            {
                relPath = absPath.Substring(Application.dataPath.Length - "Assets".Length);
            }

            folderList = AssetDatabase.LoadAssetAtPath(relPath, typeof(FolderList)) as FolderList;
            EditorPrefs.SetString("FolderListPath", relPath);

            InitializeReorderableList();
        }
Exemplo n.º 2
0
        private void OnGUI()
        {
            scrollPos = EditorGUILayout.BeginScrollView(scrollPos);

            GUILayout.Space(10);

            GUILayout.Space(5);
            GUILayout.Label("Folder Creator", normalCenterStyle);
            GUILayout.Space(5);

            if (folderList == null)
            {
                //if (GUILayout.Button("Choose a Folder List", GUILayout.MinHeight(50f)))
                //{
                //    OpenFolderCreator();
                //}
                GUILayout.Label("Please Select A Folder List Assset");
            }

            EditorGUI.BeginChangeCheck();
            folderList = EditorGUILayout.ObjectField("Folder List", folderList, typeof(FolderList), false) as FolderList;
            if (EditorGUI.EndChangeCheck())
            {
                if (folderList != null)
                {
                    InitializeReorderableList();
                }
                else
                {
                    ClearReorderableList();
                }
            }

            if (folderList != null)
            {
                DrawMainWindow();
            }

            EditorGUILayout.EndScrollView();
            if (GUI.changed && folderList != null)
            {
                EditorUtility.SetDirty(folderList);
            }
        }