diff --git a/src/Cake.Unity.FSharp.Tests/UnityEditorArgumentsTests.fs b/src/Cake.Unity.FSharp.Tests/UnityEditorArgumentsTests.fs index 8a18f60..61ba799 100644 --- a/src/Cake.Unity.FSharp.Tests/UnityEditorArgumentsTests.fs +++ b/src/Cake.Unity.FSharp.Tests/UnityEditorArgumentsTests.fs @@ -21,10 +21,18 @@ let setExecuteMethod value (arguments : UnityEditorArguments) = arguments.ExecuteMethod <- value arguments +let setReleaseCodeOptimization value (arguments : UnityEditorArguments) = + arguments.ReleaseCodeOptimization <- value + arguments + [] let ``CLI arguments with enabled BatchMode should contain "-batchmode"`` () = () |> UnityEditorArguments |> setBatchMode true |> commandLineArguments |> should haveSubstring "-batchmode" +[] +let ``CLI arguments with release code optimization should contain "-releaseCodeOptimization"`` () = + () |> UnityEditorArguments |> setReleaseCodeOptimization true |> commandLineArguments |> should haveSubstring "-releaseCodeOptimization" + [] let ``CLI arguments with custom argument "age" of value 18 should contain "--age=18"`` () = let arguments = UnityEditorArguments () diff --git a/src/Cake.Unity/UnityEditorArguments.cs b/src/Cake.Unity/UnityEditorArguments.cs index ec716aa..5010720 100644 --- a/src/Cake.Unity/UnityEditorArguments.cs +++ b/src/Cake.Unity/UnityEditorArguments.cs @@ -232,6 +232,11 @@ public class UnityEditorArguments /// public bool AcceptAPIUpdate { get; set; } + /// + /// Enables release code optimization mode, overriding the current default code optimization mode for the session. + /// + public bool ReleaseCodeOptimization { get; set; } + /// /// Custom arguments which can further be processed in Unity Editor script by calling System.Environment.GetCommandLineArgs method. /// They are supplied among other arguments in format "--key=value". @@ -474,6 +479,9 @@ internal ProcessArgumentBuilder CustomizeCommandLineArguments(ProcessArgumentBui if (AcceptAPIUpdate) builder.Append("-accept-apiupdate"); + if (ReleaseCodeOptimization) + builder.Append("-releaseCodeOptimization"); + foreach (var customArgument in customArguments) builder.AppendQuoted($"--{customArgument.Key}={customArgument.Value}");