Beispiel #1
0
        static public void DoIt()
        {
            var    guids          = Selection.assetGUIDs;
            string localOpenedDir = AssetDatabase.GUIDToAssetPath(guids[0]);

            var rootInfo = RootInfo.SearchRoot(localOpenedDir);

            if (rootInfo == null)
            {
                EditorUtility.DisplayDialog("Error", "Select directory managed by Remote Asset Manager.", "OK");
                return;
            }

            string remoteOpenedDir = rootInfo.getRemotePath(localOpenedDir);
            string remoteSrcDir    = EditorUtility.OpenFolderPanel("Import Directory", remoteOpenedDir, "");

            if (remoteSrcDir == "")
            {
                return;
            }

            var src = new DirectoryInfo(remoteSrcDir);

            if (src.ToString().StartsWith(rootInfo.RemoteRoot) == false)
            {
                EditorUtility.DisplayDialog("Error", "Select directory under of " + rootInfo.RemoteRoot, "OK");
                return;
            }

            string localDstDir = rootInfo.getRemotePath(remoteSrcDir);

            if (Directory.Exists(localDstDir))
            {
                EditorUtility.DisplayDialog("Error", localDstDir + " is already exists.", "OK");
                return;
            }

            var dst = new DirectoryInfo(localDstDir);

            CopyDirectory(src, dst);
            AssetDatabase.ImportAsset(localDstDir, ImportAssetOptions.ImportRecursive);

            var obj = AssetDatabase.LoadAssetAtPath <Object>(localDstDir);

            Selection.activeObject = obj;
            EditorGUIUtility.PingObject(obj);
        }
Beispiel #2
0
        static public void DoIt()
        {
            var    guids             = Selection.assetGUIDs;
            string localSelectedPath = AssetDatabase.GUIDToAssetPath(guids[0]);

            var rootInfo = RootInfo.SearchRoot(localSelectedPath);

            if (rootInfo == null)
            {
                EditorUtility.DisplayDialog("Error", "Select directory managed by Remote Asset Manager.", "OK");
                return;
            }

            string remoteSelectedPath = rootInfo.getRemotePath(localSelectedPath);

            remoteSelectedPath = remoteSelectedPath.Replace('/', '\\');
            Process.Start("explorer.exe", "/select," + remoteSelectedPath);
        }