void SelectGame() { string gameFolderPath = EditorUtility.OpenFolderPanel("Select Game Folder", Application.dataPath + "/../../../project/", ""); // Cancelled dialog if (string.IsNullOrEmpty(gameFolderPath)) { return; } if (!gameFolderPath.Contains("ejoy2dx/project")) { EditorUtility.DisplayDialog("错误", "请选择一个ejoy2dx工程(ejoy2dx/project/GAME_NAME)", "确定"); return; } string gameFolderName = gameFolderPath.Split(new char[] { '/', '\\' }).LastOrDefault(); if (!gameFolderPath.Contains("ejoy2dx/project/" + gameFolderName)) { EditorUtility.DisplayDialog("错误", "请选择一个ejoy2dx工程(ejoy2dx/project/GAME_NAME)", "确定"); return; } string targetPath = AssetPath; if (Directory.Exists(targetPath)) { EditorUtility.DisplayDialog("错误", "Assets/Resources/res目录下已经存在一个工程,请删除后再试", "确定"); return; } GameAssets ga = (GameAssets)target; ga.SetGame(gameFolderPath, gameFolderName); #if UNITY_EDITOR_WIN Process cmd = Process.Start("CMD.exe", string.Format("/C mklink /J \"{0}\" \"{1}/asset\"", targetPath, gameFolderPath)); cmd.WaitForExit(); #elif UNITY_EDITOR_OSX || UNITY_EDITOR_LINUX // @todo #endif AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate); }