Skip to content

Commit

Permalink
Update BuildTemplate.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
peeweek committed Mar 29, 2019
1 parent 8abe469 commit 68e5c4f
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions Editor/Assets/BuildTemplate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,29 @@ public BuildReport DoBuild(bool run = false)

if (BuildEnabled)
{
report = BuildPipeline.BuildPlayer(SceneList.scenePaths, BuildPath + ExecutableName, Profile.Target, BuildOptions.None);
if (run)
try
{
if (
report.summary.result == BuildResult.Succeeded ||
EditorUtility.DisplayDialog("Run Failed Build", "The build has failed or has been canceled, do you want to attempt to run previous build instead?", "Yes", "No")
)
EditorUtility.DisplayProgressBar("Build Frontend", $"Building player : {name}", 0.0f);
report = BuildPipeline.BuildPlayer(SceneList.scenePaths, BuildPath + ExecutableName, Profile.Target, BuildOptions.None);
if (run)
{
RunBuild();
if (
report.summary.result == BuildResult.Succeeded ||
EditorUtility.DisplayDialog("Run Failed Build", "The build has failed or has been canceled, do you want to attempt to run previous build instead?", "Yes", "No")
)
{
RunBuild();
}
}
}
catch(Exception e)
{

}
finally
{
EditorUtility.ClearProgressBar();
}
}
else
{
Expand All @@ -58,7 +70,7 @@ public void RunBuild()
info.WorkingDirectory = path;
info.UseShellExecute = false;

Debug.Log($"Running Player : {info.FileName}");
EditorUtility.DisplayProgressBar("Build Frontend",$"Running Player : {info.FileName}", 1.0f);

Process process = Process.Start(info);

Expand Down

0 comments on commit 68e5c4f

Please sign in to comment.