From 99c2adc1f3f91ee9f6240b35b38858fb57747393 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Mon, 11 Sep 2023 22:32:17 +0200 Subject: [PATCH] Add game settings formatting for created plugin ProjectInfo #1335 --- Source/Editor/Windows/PluginsWindow.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Source/Editor/Windows/PluginsWindow.cs b/Source/Editor/Windows/PluginsWindow.cs index f4acfffc8..fa2547797 100644 --- a/Source/Editor/Windows/PluginsWindow.cs +++ b/Source/Editor/Windows/PluginsWindow.cs @@ -669,6 +669,17 @@ namespace FlaxEditor.Windows flaxPluginProjContents.EditorTarget = $"{pluginCodeName}EditorTarget"; await File.WriteAllTextAsync(newFlaxProjFile, JsonSerializer.Serialize(flaxPluginProjContents, typeof(ProjectInfo))); + // Format game settings + var gameSettingsPath = Path.Combine(newPluginPath, "Content", "GameSettings.json"); + if (File.Exists(gameSettingsPath)) + { + var contents = await File.ReadAllTextAsync(gameSettingsPath); + contents = contents.Replace("Example Plugin", pluginName); + contents = contents.Replace("\"CompanyName\": \"Flax\"", $"\"CompanyName\": \"{companyName}\""); + contents = contents.Replace("1.0", pluginVersion); + await File.WriteAllTextAsync(gameSettingsPath, contents, Encoding.UTF8); + } + // Rename source directories var sourcePath = Path.Combine(newPluginPath, "Source"); var sourceDirectories = Directory.GetDirectories(sourcePath);