Skip to content

Commit

Permalink
[unity] Smarter way of opening unity project
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyfa committed Nov 23, 2020
1 parent 9908835 commit d1b7ba0
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions plugins/unity/tools/src/tools/tasks/unity/Project.hx
Expand Up @@ -34,27 +34,38 @@ class Project extends tools.Task {
// Create unity project if needed
UnityProject.createUnityProjectIfNeeded(cwd, project);

/*
print('Copy Main.dll');
// Copy dll
var srcDllPath = Path.join([outTargetPath, 'bin', 'bin', 'Main.dll']);
var dstDllPath = Path.join([unityProjectPath, 'Assets', 'Main.dll']);
Files.copyIfNeeded(srcDllPath, dstDllPath);
*/

var run = extractArgFlag(args, 'run');

if (run) {

print('Open project with Unity Editor...');

var unityEditorPath = UnityEditor.resolveUnityEditorPath(cwd, project);
var projectPath = UnityProject.resolveUnityProjectPath(cwd, project);

// TODO windows
var cmd = Path.join([unityEditorPath, 'Contents/MacOS/Unity']);
var ceramicScenePath = Path.join([projectPath, 'Assets/Scenes/CeramicScene.unity']);

command(cmd, ['-openfile', ceramicScenePath]);
var processDir = Path.join([projectPath, 'Temp', 'ProcessJobs']);
if (FileSystem.exists(processDir)) {

print('Project seems already open with Unity Editor');

}
else {

print('Open project with Unity Editor...');

var unityEditorPath = UnityEditor.resolveUnityEditorPath(cwd, project);

// TODO windows
var cmd = Path.join([unityEditorPath, 'Contents/MacOS/Unity']);
var ceramicScenePath = Path.join([projectPath, 'Assets/Scenes/CeramicScene.unity']);

command(cmd, ['-openfile', ceramicScenePath], { detached: true });
}

}

Expand Down

0 comments on commit d1b7ba0

Please sign in to comment.