From 7418d60f24a605dabdb64418c140f8a2350f5b1c Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Sat, 5 Jul 2025 18:09:30 -0500 Subject: [PATCH 1/3] Add editor option for build configuration when using cook and run. --- Source/Editor/Options/GeneralOptions.cs | 6 ++++++ Source/Editor/Windows/GameCookerWindow.cs | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Source/Editor/Options/GeneralOptions.cs b/Source/Editor/Options/GeneralOptions.cs index 59fac7a63..23dc17733 100644 --- a/Source/Editor/Options/GeneralOptions.cs +++ b/Source/Editor/Options/GeneralOptions.cs @@ -127,6 +127,12 @@ namespace FlaxEditor.Options BuildAction.NavMesh, }; + /// + /// Gets or sets the build configuration to use when using Cook and Run option in the editor. + /// + [EditorDisplay("General"), EditorOrder(201), ExpandGroups, Tooltip("The build configuration to use when using Cook and Run option in the editor.")] + public BuildConfiguration CookAndRunBuildConfiguration { get; set; } = BuildConfiguration.Development; + /// /// Gets or sets a value indicating whether perform automatic scripts reload on main window focus. /// diff --git a/Source/Editor/Windows/GameCookerWindow.cs b/Source/Editor/Windows/GameCookerWindow.cs index 54aec19ab..cb0ab4c7a 100644 --- a/Source/Editor/Windows/GameCookerWindow.cs +++ b/Source/Editor/Windows/GameCookerWindow.cs @@ -976,6 +976,7 @@ namespace FlaxEditor.Windows Editor.Log("Building and running"); GameCooker.GetCurrentPlatform(out var platform, out var buildPlatform, out var buildConfiguration); var numberOfClients = Editor.Options.Options.Interface.NumberOfGameClientsToLaunch; + var buildConfig = Editor.Options.Options.General.CookAndRunBuildConfiguration; for (int i = 0; i < numberOfClients; i++) { var buildOptions = BuildOptions.AutoRun; @@ -988,7 +989,7 @@ namespace FlaxEditor.Windows { Output = _buildTabProxy.PerPlatformOptions[platform].Output, Platform = buildPlatform, - Mode = buildConfiguration, + Mode = buildConfig, }, Options = buildOptions, }); @@ -1003,6 +1004,7 @@ namespace FlaxEditor.Windows Editor.Log("Running cooked build"); GameCooker.GetCurrentPlatform(out var platform, out var buildPlatform, out var buildConfiguration); var numberOfClients = Editor.Options.Options.Interface.NumberOfGameClientsToLaunch; + var buildConfig = Editor.Options.Options.General.CookAndRunBuildConfiguration; for (int i = 0; i < numberOfClients; i++) { _buildingQueue.Enqueue(new QueueItem @@ -1011,7 +1013,7 @@ namespace FlaxEditor.Windows { Output = _buildTabProxy.PerPlatformOptions[platform].Output, Platform = buildPlatform, - Mode = buildConfiguration, + Mode = buildConfig, }, Options = BuildOptions.AutoRun | BuildOptions.NoCook, }); From b3f88e156c7fc702498703ed7d9da8bc25ccafd0 Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Sat, 5 Jul 2025 18:11:26 -0500 Subject: [PATCH 2/3] Small change to out variable that is not used anymore. --- Source/Editor/Windows/GameCookerWindow.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Editor/Windows/GameCookerWindow.cs b/Source/Editor/Windows/GameCookerWindow.cs index cb0ab4c7a..eb65fd62b 100644 --- a/Source/Editor/Windows/GameCookerWindow.cs +++ b/Source/Editor/Windows/GameCookerWindow.cs @@ -974,7 +974,7 @@ namespace FlaxEditor.Windows public void BuildAndRun() { Editor.Log("Building and running"); - GameCooker.GetCurrentPlatform(out var platform, out var buildPlatform, out var buildConfiguration); + GameCooker.GetCurrentPlatform(out var platform, out var buildPlatform, out _); var numberOfClients = Editor.Options.Options.Interface.NumberOfGameClientsToLaunch; var buildConfig = Editor.Options.Options.General.CookAndRunBuildConfiguration; for (int i = 0; i < numberOfClients; i++) @@ -1002,7 +1002,7 @@ namespace FlaxEditor.Windows public void RunCooked() { Editor.Log("Running cooked build"); - GameCooker.GetCurrentPlatform(out var platform, out var buildPlatform, out var buildConfiguration); + GameCooker.GetCurrentPlatform(out var platform, out var buildPlatform, out _); var numberOfClients = Editor.Options.Options.Interface.NumberOfGameClientsToLaunch; var buildConfig = Editor.Options.Options.General.CookAndRunBuildConfiguration; for (int i = 0; i < numberOfClients; i++) From e6265105b522fc5f2042626d7d0697bcc60458b8 Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Sat, 19 Jul 2025 15:39:11 -0500 Subject: [PATCH 3/3] Move to interface options. --- Source/Editor/Options/GeneralOptions.cs | 6 ------ Source/Editor/Options/InterfaceOptions.cs | 6 ++++++ Source/Editor/Windows/GameCookerWindow.cs | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Source/Editor/Options/GeneralOptions.cs b/Source/Editor/Options/GeneralOptions.cs index 23dc17733..59fac7a63 100644 --- a/Source/Editor/Options/GeneralOptions.cs +++ b/Source/Editor/Options/GeneralOptions.cs @@ -127,12 +127,6 @@ namespace FlaxEditor.Options BuildAction.NavMesh, }; - /// - /// Gets or sets the build configuration to use when using Cook and Run option in the editor. - /// - [EditorDisplay("General"), EditorOrder(201), ExpandGroups, Tooltip("The build configuration to use when using Cook and Run option in the editor.")] - public BuildConfiguration CookAndRunBuildConfiguration { get; set; } = BuildConfiguration.Development; - /// /// Gets or sets a value indicating whether perform automatic scripts reload on main window focus. /// diff --git a/Source/Editor/Options/InterfaceOptions.cs b/Source/Editor/Options/InterfaceOptions.cs index 617c1c3de..e86f5cf42 100644 --- a/Source/Editor/Options/InterfaceOptions.cs +++ b/Source/Editor/Options/InterfaceOptions.cs @@ -420,6 +420,12 @@ namespace FlaxEditor.Options [DefaultValue(1), Range(1, 4)] [EditorDisplay("Cook & Run"), EditorOrder(600)] public int NumberOfGameClientsToLaunch = 1; + + /// + /// Gets or sets the build configuration to use when using Cook and Run option in the editor. + /// + [EditorDisplay("Cook & Run"), EditorOrder(601), ExpandGroups, Tooltip("The build configuration to use when using Cook and Run option in the editor.")] + public BuildConfiguration CookAndRunBuildConfiguration { get; set; } = BuildConfiguration.Development; /// /// Gets or sets the curvature of the line connecting to connected visject nodes. diff --git a/Source/Editor/Windows/GameCookerWindow.cs b/Source/Editor/Windows/GameCookerWindow.cs index eb65fd62b..01c482c19 100644 --- a/Source/Editor/Windows/GameCookerWindow.cs +++ b/Source/Editor/Windows/GameCookerWindow.cs @@ -976,7 +976,7 @@ namespace FlaxEditor.Windows Editor.Log("Building and running"); GameCooker.GetCurrentPlatform(out var platform, out var buildPlatform, out _); var numberOfClients = Editor.Options.Options.Interface.NumberOfGameClientsToLaunch; - var buildConfig = Editor.Options.Options.General.CookAndRunBuildConfiguration; + var buildConfig = Editor.Options.Options.Interface.CookAndRunBuildConfiguration; for (int i = 0; i < numberOfClients; i++) { var buildOptions = BuildOptions.AutoRun; @@ -1004,7 +1004,7 @@ namespace FlaxEditor.Windows Editor.Log("Running cooked build"); GameCooker.GetCurrentPlatform(out var platform, out var buildPlatform, out _); var numberOfClients = Editor.Options.Options.Interface.NumberOfGameClientsToLaunch; - var buildConfig = Editor.Options.Options.General.CookAndRunBuildConfiguration; + var buildConfig = Editor.Options.Options.Interface.CookAndRunBuildConfiguration; for (int i = 0; i < numberOfClients; i++) { _buildingQueue.Enqueue(new QueueItem