Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions UnityLauncherPro/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@
<MenuItem Header="Build">
<MenuItem x:Name="menuBatchBuildAndroid" Header="Android" Click="MenuBatchBuildAndroid_Click"/>
<MenuItem x:Name="menuBatchBuildIOS" Header="IOS" Click="MenuBatchBuildIOS_Click"/>
<MenuItem x:Name="menuBatchBuildCustom" Header="Custom" Click="MenuBatchBuildCustom_Click"/>
</MenuItem>
<MenuItem Header="Tools">
<MenuItem x:Name="menuExcludeFromDefender" Header="Exclude Path From Defender" Click="menuExcludeFromDefender_Click"/>
Expand Down
6 changes: 6 additions & 0 deletions UnityLauncherPro/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3226,6 +3226,12 @@ private void MenuBatchBuildIOS_Click(object sender, RoutedEventArgs e)
Tools.BuildProject(proj, Platform.iOS);
}

private void MenuBatchBuildCustom_Click(object sender, RoutedEventArgs e)
{
var proj = GetSelectedProject();
Tools.BuildProjectCustom(proj);
}

private void ChkCheckPlasticBranch_Checked(object sender, RoutedEventArgs e)
{
if (this.IsActive == false) return; // dont run code on window init
Expand Down
29 changes: 28 additions & 1 deletion UnityLauncherPro/Tools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2104,7 +2104,34 @@ static string[] GetScenes()

}

// runs unity SimpleWebServer.exe and launches default Browser into project build/ folder'
public static void BuildProjectCustom(Project proj)
{
Console.WriteLine("Building " + proj.Title + " (custom)");
SetStatus("Build process started: " + DateTime.Now.ToString("HH:mm:ss"));

// get selected project unity exe path
var unityExePath = Tools.GetUnityExePath(proj.Version);
if (unityExePath == null) return;

// create commandline string for building and launch it
//var buildcmd = $"\"{unityExePath}\" -quit -batchmode -nographics -projectPath \"{proj.Path}\" -executeMethod \"Builder.BuildAndroid\" -buildTarget android -logFile -";
// TODO test without nographics : https://forum.unity.com/threads/batch-build-one-scene-is-black-works-in-normal-file-build.1282823/#post-9456524
var buildParams = $" -quit -batchmode -nographics -projectPath \"{proj.Path}\" -executeMethod \"UnityLauncherProToolsCustom.BuildCustom\"";
Console.WriteLine("buildcmd= " + buildParams);

// launch build
var proc = Tools.LaunchExe(unityExePath, buildParams);

// wait for process exit then open output folder
proc.Exited += (o, i) =>
{
SetStatus("Build process finished: " + DateTime.Now.ToString("HH:mm:ss"));
// TODO set color based on results
SetBuildStatus(Colors.Green);
};
}

// runs unity SimpleWebServer.exe and launches default Browser into project build/ folder'
public static void LaunchWebGL(Project proj, string relativeFolder)
{
var projPath = proj?.Path.Replace('/', '\\');
Expand Down