Created
July 31, 2014 15:32
-
-
Save tayl0r/8fa8b1df5b218d406e0a to your computer and use it in GitHub Desktop.
command line Unity startup of specific project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
perl startUnity.pl |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
# figure out project path | |
use Cwd 'abs_path'; | |
my $cwd = abs_path($0); | |
$cwd =~ s/$0//g; | |
my $projPath; | |
if ($^O eq "MSWin32") { | |
$projPath = $cwd . '..\UnityProject\JackpotSlots'; | |
} else { | |
$projPath = $cwd . '../UnityProject/JackpotSlots'; | |
} | |
# figure out unity path | |
my @unityPaths = ('c:\Program Files (x86)\Unity\Editor\Unity.exe', '/Applications/Unity4.5/Unity.app/Contents/MacOS/Unity', '/Applications/Unity/Unity.app/Contents/MacOS/Unity'); | |
my $unityPath; | |
foreach my $dir (@unityPaths) { | |
if (-d $dir || -e $dir) { | |
$unityPath = $dir; | |
} | |
} | |
print "$unityPath\n"; | |
print "$projPath\n"; | |
my $cmd = qq|"$unityPath" -projectPath "$projPath"|; | |
use threads; | |
my $thr = threads->create(sub { system($_[0]); }, $cmd); | |
$thr->detach(); | |
sleep 2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
perl startUnity.pl |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment