Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f90e8ac

Browse files
Merge pull request #199 from krisrok/feature/build_custom
Add a quick "custom" build command
2 parents 07432f9 + da156d9 commit f90e8ac

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

‎UnityLauncherPro/MainWindow.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@
227227
<MenuItem Header="Build">
228228
<MenuItem x:Name="menuBatchBuildAndroid" Header="Android" Click="MenuBatchBuildAndroid_Click"/>
229229
<MenuItem x:Name="menuBatchBuildIOS" Header="IOS" Click="MenuBatchBuildIOS_Click"/>
230+
<MenuItem x:Name="menuBatchBuildCustom" Header="Custom" Click="MenuBatchBuildCustom_Click"/>
230231
</MenuItem>
231232
<MenuItem Header="Tools">
232233
<MenuItem x:Name="menuExcludeFromDefender" Header="Exclude Path From Defender" Click="menuExcludeFromDefender_Click"/>

‎UnityLauncherPro/MainWindow.xaml.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3226,6 +3226,12 @@ private void MenuBatchBuildIOS_Click(object sender, RoutedEventArgs e)
32263226
Tools.BuildProject(proj, Platform.iOS);
32273227
}
32283228

3229+
private void MenuBatchBuildCustom_Click(object sender, RoutedEventArgs e)
3230+
{
3231+
var proj = GetSelectedProject();
3232+
Tools.BuildProjectCustom(proj);
3233+
}
3234+
32293235
private void ChkCheckPlasticBranch_Checked(object sender, RoutedEventArgs e)
32303236
{
32313237
if (this.IsActive == false) return; // dont run code on window init

‎UnityLauncherPro/Tools.cs

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2104,7 +2104,34 @@ static string[] GetScenes()
21042104

21052105
}
21062106

2107-
// runs unity SimpleWebServer.exe and launches default Browser into project build/ folder'
2107+
public static void BuildProjectCustom(Project proj)
2108+
{
2109+
Console.WriteLine("Building " + proj.Title + " (custom)");
2110+
SetStatus("Build process started: " + DateTime.Now.ToString("HH:mm:ss"));
2111+
2112+
// get selected project unity exe path
2113+
var unityExePath = Tools.GetUnityExePath(proj.Version);
2114+
if (unityExePath == null) return;
2115+
2116+
// create commandline string for building and launch it
2117+
//var buildcmd = $"\"{unityExePath}\" -quit -batchmode -nographics -projectPath \"{proj.Path}\" -executeMethod \"Builder.BuildAndroid\" -buildTarget android -logFile -";
2118+
// TODO test without nographics : https://forum.unity.com/threads/batch-build-one-scene-is-black-works-in-normal-file-build.1282823/#post-9456524
2119+
var buildParams = $" -quit -batchmode -nographics -projectPath \"{proj.Path}\" -executeMethod \"UnityLauncherProToolsCustom.BuildCustom\"";
2120+
Console.WriteLine("buildcmd= " + buildParams);
2121+
2122+
// launch build
2123+
var proc = Tools.LaunchExe(unityExePath, buildParams);
2124+
2125+
// wait for process exit then open output folder
2126+
proc.Exited += (o, i) =>
2127+
{
2128+
SetStatus("Build process finished: " + DateTime.Now.ToString("HH:mm:ss"));
2129+
// TODO set color based on results
2130+
SetBuildStatus(Colors.Green);
2131+
};
2132+
}
2133+
2134+
// runs unity SimpleWebServer.exe and launches default Browser into project build/ folder'
21082135
public static void LaunchWebGL(Project proj, string relativeFolder)
21092136
{
21102137
var projPath = proj?.Path.Replace('/', '\\');

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /