Skip to content

Commit fb62cee

Browse files
author
Richard Lyle
committed
* Build will now exit Unity if -executemethod command line option is used.
1 parent 47aace9 commit fb62cee

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Editor/Build.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,18 @@ private static IEnumerator ExecuteBuild()
122122
FullSerializer.AotHelpers.CleanAOT();
123123
IsBuilding = false;
124124

125+
// if BuildPlayer returned no error, but we can't find the file, flag this build as a failure then..
126+
if (string.IsNullOrEmpty( BuildError) && !File.Exists( buildPath ) && !Directory.Exists( buildPath ) )
127+
BuildError = "Failed to build player: " + buildPath;
128+
129+
// check the command line arguments, if we find -executeMethod Build.* then quit this editor..
130+
string [] args = Environment.GetCommandLineArgs();
131+
for(int i=0;i<args.Length;++i)
132+
{
133+
if ( args[i] == "-executemethod" && (i + 1) < args.Length && args[i+1].StartsWith( "Build." ) )
134+
EditorApplication.Exit( string.IsNullOrEmpty(BuildError) ? 0 : 1);
135+
}
136+
125137
// TODO: Check if launch from the command line, if so then quit out..
126138
yield break;
127139
}

0 commit comments

Comments
 (0)