diff --git a/Editor/Commandline.cs b/Editor/Commandline.cs index 3f10226..15457b9 100644 --- a/Editor/Commandline.cs +++ b/Editor/Commandline.cs @@ -55,9 +55,6 @@ private static void Bootstrap() // Set first open Scene EditorSceneManager.playModeStartScene = myWantedStartScene; - // Apply commandline arguments - settings.OverwriteByCommandLineArguments(new Arguments()); - // Register event handler for terminate autopilot EditorApplication.playModeStateChanged += OnChangePlayModeState; diff --git a/Runtime/Launcher.cs b/Runtime/Launcher.cs index 24e7cc0..75f5f7f 100644 --- a/Runtime/Launcher.cs +++ b/Runtime/Launcher.cs @@ -96,9 +96,6 @@ private static void LaunchAutopilotOnPlayerFromCommandline() throw new InvalidOperationException("Autopilot is already running"); } - // Apply commandline arguments - settings.OverwriteByCommandLineArguments(new Arguments()); - state.launchFrom = LaunchType.Commandline; state.settings = settings; } diff --git a/Runtime/Settings/ArgumentCapture/ArgumentCapture.cs b/Runtime/Settings/ArgumentCapture/ArgumentCapture.cs index 6a6a343..eb4bd90 100644 --- a/Runtime/Settings/ArgumentCapture/ArgumentCapture.cs +++ b/Runtime/Settings/ArgumentCapture/ArgumentCapture.cs @@ -21,10 +21,11 @@ internal static (bool, T) Capture(string key, string[] args = null) if (string.IsNullOrEmpty(captureString)) { - Debug.Log($"Argument not found. key: {key}"); return (false, default(T)); } + Debug.Log($"Capture commandline argument: {key}"); + switch (typeof(T)) { case Type stringType when stringType == typeof(string): diff --git a/Runtime/Settings/AutopilotSettings.cs b/Runtime/Settings/AutopilotSettings.cs index a0d168a..5119195 100644 --- a/Runtime/Settings/AutopilotSettings.cs +++ b/Runtime/Settings/AutopilotSettings.cs @@ -270,6 +270,8 @@ private static void Initialize() var settings = AutopilotState.Instance.settings; Assert.IsNotNull(settings); + settings.OverwriteByCommandLineArguments(new Arguments()); + settings.ConvertLoggersFromObsoleteLogger(); // Note: before create default logger. settings.CreateDefaultLoggerIfNeeded(); diff --git a/Tests/Runtime/AutopilotTest.cs b/Tests/Runtime/AutopilotTest.cs index cdfafdf..e56b53a 100644 --- a/Tests/Runtime/AutopilotTest.cs +++ b/Tests/Runtime/AutopilotTest.cs @@ -69,6 +69,7 @@ public async Task Start_LoggerIsNotSet_UsingDefaultLogger() autopilotSettings.lifespanSec = 1; await Launcher.LaunchAutopilotAsync(autopilotSettings); + await UniTask.NextFrame(); // wait flushing log for subsequence tests LogAssert.Expect(LogType.Log, "Launched autopilot"); // using console logger }