From 6995c112603f51eddf5140bae08b5ed82556bbca Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 18 Nov 2025 08:54:50 +0000 Subject: [PATCH 1/3] Initial plan From 759ab81b9f64814b9465809287eef80aefb9ae0d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 18 Nov 2025 09:00:11 +0000 Subject: [PATCH 2/3] Add command line overrides for all LootLockerConfig properties Co-authored-by: kirre-bylund <4068377+kirre-bylund@users.noreply.github.com> --- Runtime/Game/Resources/LootLockerConfig.cs | 59 ++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/Runtime/Game/Resources/LootLockerConfig.cs b/Runtime/Game/Resources/LootLockerConfig.cs index 9bd8d684..5772bfb6 100644 --- a/Runtime/Game/Resources/LootLockerConfig.cs +++ b/Runtime/Game/Resources/LootLockerConfig.cs @@ -74,6 +74,12 @@ private void CheckForSettingOverrides() string[] args = System.Environment.GetCommandLineArgs(); for (int i = 0; i < args.Length; i++) { + // Ensure there's a next argument for value parameters + if (i + 1 >= args.Length) + { + continue; + } + if (args[i] == "-apikey") { apiKey = args[i + 1]; @@ -86,6 +92,59 @@ private void CheckForSettingOverrides() { UrlCoreOverride = args[i + 1]; } + else if (args[i] == "-gameversion") + { + game_version = args[i + 1]; + } + else if (args[i] == "-timeout") + { + if (float.TryParse(args[i + 1], out float timeout)) + { + clientSideRequestTimeOut = timeout; + } + } + else if (args[i] == "-loglevel") + { + if (System.Enum.TryParse(args[i + 1], true, out LootLockerLogger.LogLevel level)) + { + logLevel = level; + } + } + else if (args[i] == "-prettifyjson") + { + if (bool.TryParse(args[i + 1], out bool prettify)) + { + prettifyJson = prettify; + } + } + else if (args[i] == "-obfuscatelogs") + { + if (bool.TryParse(args[i + 1], out bool obfuscate)) + { + obfuscateLogs = obfuscate; + } + } + else if (args[i] == "-logerrorsaswarnings") + { + if (bool.TryParse(args[i + 1], out bool errorsAsWarnings)) + { + logErrorsAsWarnings = errorsAsWarnings; + } + } + else if (args[i] == "-loginbuilds") + { + if (bool.TryParse(args[i + 1], out bool inBuilds)) + { + logInBuilds = inBuilds; + } + } + else if (args[i] == "-allowtokenrefresh") + { + if (bool.TryParse(args[i + 1], out bool allowRefresh)) + { + allowTokenRefresh = allowRefresh; + } + } } #endif } From 4c07e2f3b966fdadd91d693b5c063e7e083ea728 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 18 Nov 2025 09:29:36 +0000 Subject: [PATCH 3/3] Add semver validation for game_version command line argument Co-authored-by: kirre-bylund <4068377+kirre-bylund@users.noreply.github.com> --- Runtime/Game/Resources/LootLockerConfig.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Runtime/Game/Resources/LootLockerConfig.cs b/Runtime/Game/Resources/LootLockerConfig.cs index 5772bfb6..e9e63234 100644 --- a/Runtime/Game/Resources/LootLockerConfig.cs +++ b/Runtime/Game/Resources/LootLockerConfig.cs @@ -1,5 +1,6 @@ using System; using System.IO; +using System.Text.RegularExpressions; #if UNITY_EDITOR using UnityEditor; using UnityEditor.PackageManager; @@ -94,7 +95,15 @@ private void CheckForSettingOverrides() } else if (args[i] == "-gameversion") { - game_version = args[i + 1]; + string versionValue = args[i + 1]; + if (IsSemverString(versionValue)) + { + game_version = versionValue; + } + else + { + Debug.LogWarning($"Invalid game version format: '{versionValue}'. Game version must follow Semantic Versioning pattern X.Y.Z.B (e.g., 1.0.0 or 1.0.0.0). See https://docs.lootlocker.com/the-basics/core-concepts/glossary#game-version"); + } } else if (args[i] == "-timeout") { @@ -149,6 +158,11 @@ private void CheckForSettingOverrides() #endif } + private static bool IsSemverString(string str) + { + return Regex.IsMatch(str, @"^(0|[1-9]\d*)\.(0|[1-9]\d*)(?:\.(0|[1-9]\d*))?(?:\.(0|[1-9]\d*))?$"); + } + #if UNITY_EDITOR [InitializeOnLoadMethod] static void CreateConfigFile()