Skip to content

Commit

Permalink
Fix to unify the call for applying commandline args into a single ent…
Browse files Browse the repository at this point in the history
…ry point
  • Loading branch information
nowsprinting committed Nov 6, 2024
1 parent 51e7cae commit 553c9a3
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 7 deletions.
3 changes: 0 additions & 3 deletions Editor/Commandline.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
3 changes: 0 additions & 3 deletions Runtime/Launcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
3 changes: 2 additions & 1 deletion Runtime/Settings/ArgumentCapture/ArgumentCapture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ internal static (bool, T) Capture<T>(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):
Expand Down
2 changes: 2 additions & 0 deletions Runtime/Settings/AutopilotSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
1 change: 1 addition & 0 deletions Tests/Runtime/AutopilotTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 553c9a3

Please sign in to comment.