From fecb9a8c518a95cdbeec064cff777c525144b1a7 Mon Sep 17 00:00:00 2001 From: NGenesis Date: Tue, 12 Nov 2024 17:28:12 +0000 Subject: [PATCH] Added "Hide Menu on Launch" setting to support automatically hiding of the ClientSim menu when initially entering playmode. --- .../Editor/Windows/ClientSimSettingsWindow.cs | 3 +++ .../Runtime/Settings/ClientSimSettings.cs | 1 + Packages/com.vrchat.ClientSim/Runtime/System/ClientSimMenu.cs | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/Packages/com.vrchat.ClientSim/Editor/Windows/ClientSimSettingsWindow.cs b/Packages/com.vrchat.ClientSim/Editor/Windows/ClientSimSettingsWindow.cs index 364e4be..89de2e3 100644 --- a/Packages/com.vrchat.ClientSim/Editor/Windows/ClientSimSettingsWindow.cs +++ b/Packages/com.vrchat.ClientSim/Editor/Windows/ClientSimSettingsWindow.cs @@ -14,6 +14,7 @@ public class ClientSimSettingsWindow : EditorWindow private readonly GUIContent _generalFoldoutGuiContent = new GUIContent("General Settings", ""); private readonly GUIContent _enableToggleGuiContent = new GUIContent("Enable ClientSim", "If enabled, all triggers will function similarly to VRChat. Note that behavior may be different than the actual game!"); private readonly GUIContent _displayLogsToggleGuiContent = new GUIContent("Enable Console Logging", "Enabling logging will print messages to the console when certain events happen. Examples include trigger execution, pickup grabbed, station entered, etc."); + private readonly GUIContent _hideMenuOnLaunchToggleGuiContent = new GUIContent("Hide Menu On Launch", "Enabling this setting will prevent the ClientSim menu from being displayed when initially entering play mode."); private readonly GUIContent _deleteEditorOnlyToggleGuiContent = new GUIContent("Remove \"EditorOnly\"", "Enabling this setting will ensure that all objects with the tag \"EditorOnly\" are deleted when in playmode. This can be helpful in finding objects that will not be uploaded with your world. Enable console logging to see which objects are deleted."); private readonly GUIContent _startupDelayGuiContent = new GUIContent("Startup Delay", "The duration that the Client Sim will wait to simulate the VRChat client loading before spawning the player and initializing Udon. This is useful to test when Unity components behave differently at startup compared to VRChat."); private readonly GUIContent _stopOnScriptChangesToggleGuiContent = new GUIContent("Stop On Script Changes", "If enabled, the editor will stop if script changes are detected while in play mode. This will override the Unity Editor setting 'Preferences > General > Script Changes While Playing'."); @@ -345,6 +346,8 @@ private void DrawGeneralSettings() // Settings that cannot be changed at runtime EditorGUI.BeginDisabledGroup(Application.isPlaying); + + _settings.hideMenuOnLaunch = EditorGUILayout.Toggle(_hideMenuOnLaunchToggleGuiContent, _settings.hideMenuOnLaunch); _settings.deleteEditorOnly = EditorGUILayout.Toggle(_deleteEditorOnlyToggleGuiContent, _settings.deleteEditorOnly); diff --git a/Packages/com.vrchat.ClientSim/Runtime/Settings/ClientSimSettings.cs b/Packages/com.vrchat.ClientSim/Runtime/Settings/ClientSimSettings.cs index 2326e1b..1c83ee2 100644 --- a/Packages/com.vrchat.ClientSim/Runtime/Settings/ClientSimSettings.cs +++ b/Packages/com.vrchat.ClientSim/Runtime/Settings/ClientSimSettings.cs @@ -99,6 +99,7 @@ public static ClientSimSettings Instance // TODO move settings to be per project instead of global to all public bool enableClientSim = true; public bool displayLogs = true; + public bool hideMenuOnLaunch = false; public bool deleteEditorOnly = true; public bool spawnPlayer = true; diff --git a/Packages/com.vrchat.ClientSim/Runtime/System/ClientSimMenu.cs b/Packages/com.vrchat.ClientSim/Runtime/System/ClientSimMenu.cs index 746f5f9..293fe57 100644 --- a/Packages/com.vrchat.ClientSim/Runtime/System/ClientSimMenu.cs +++ b/Packages/com.vrchat.ClientSim/Runtime/System/ClientSimMenu.cs @@ -161,6 +161,10 @@ private void Start() OpenSettings(); SetDisplayedPage(ClientSimDisplayedPage.INVALID_SETTINGS_PAGE); } + else if (_settings.hideMenuOnLaunch) + { + shouldShowMenu = false; + } else if (_settings.initializationDelay > 0) { SetDisplayedPage(ClientSimDisplayedPage.DELAYED_START_PAGE);