diff --git a/Editor/Commandline.cs b/Editor/Commandline.cs index a731655..5001c63 100644 --- a/Editor/Commandline.cs +++ b/Editor/Commandline.cs @@ -1,8 +1,8 @@ -// Copyright (c) 2023 DeNA Co., Ltd. +// Copyright (c) 2023-2024 DeNA Co., Ltd. // This software is released under the MIT License. -using System.Reflection; using DeNA.Anjin.Settings; +using TestHelper.RuntimeInternals; using UnityEditor; using UnityEditor.SceneManagement; using UnityEngine; @@ -49,12 +49,12 @@ private static void Bootstrap() return; } - // Show GameView window even in batchmode. It can bypass batchmode limitations. e.g., WaitForEndOfFrame. - FocusGameView(); - // Set first open Scene EditorSceneManager.playModeStartScene = myWantedStartScene; + // GameView resolution set and show window even in batchmode. It can bypass batchmode limitations. e.g., WaitForEndOfFrame. + SetGameViewResolution(); + // Activate autopilot and enter play mode var state = AutopilotState.Instance; state.launchFrom = LaunchType.Commandline; @@ -85,14 +85,13 @@ private static string GetAutopilotSettingsFromArguments() return args.AutopilotSettings.Value(); } - private static void FocusGameView() + private static void SetGameViewResolution() { - var assembly = Assembly.Load("UnityEditor.dll"); - var viewClass = Application.isBatchMode - ? "UnityEditor.GameView" - : "UnityEditor.PlayModeView"; - var gameView = assembly.GetType(viewClass); - EditorWindow.GetWindow(gameView, false, null, true); + var args = new Arguments(); + var width = (uint)args.GameViewWidth.Value(); + var height = (uint)args.GameViewHeight.Value(); + var name = $"{width}x{height}"; + GameViewControlHelper.SetResolution(width, height, name); } } } diff --git a/Editor/DeNA.Anjin.Editor.asmdef b/Editor/DeNA.Anjin.Editor.asmdef index 8d19fee..9c4aebb 100644 --- a/Editor/DeNA.Anjin.Editor.asmdef +++ b/Editor/DeNA.Anjin.Editor.asmdef @@ -4,8 +4,8 @@ "references": [ "UniTask", "DeNA.Anjin", - "TestHelper.Monkey.Annotations", - "TestHelper.Monkey" + "TestHelper.RuntimeInternals", + "TestHelper.Monkey.Annotations" ], "includePlatforms": [ "Editor" @@ -18,4 +18,4 @@ "defineConstraints": [], "versionDefines": [], "noEngineReferences": false -} +} \ No newline at end of file diff --git a/README.md b/README.md index 27c7285..b786aeb 100644 --- a/README.md +++ b/README.md @@ -207,6 +207,8 @@ For details on each argument, see the entry of the same name in the "Generate an