From 6ca3f3e027606ed4479965074bf4b8ece63ad9c4 Mon Sep 17 00:00:00 2001 From: Toys0125 Date: Sun, 21 Dec 2025 22:24:49 -0600 Subject: [PATCH 1/4] Change the location of keystore to My Documents for Desktop systems. Majority of backup solutions don't include AppData or LocalLow due to the amount of files and cache directories. I'm making this change to help reduce people frustration when the file itself gets corrupt. Includes a system to migrate from the old and into the new location. Still uses the normal CompanyName/ProductName. --- .../UI Panels/BasisDataStoreAvatarKeys.cs | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/Basis/Packages/com.basis.framework/UI Panels/BasisDataStoreAvatarKeys.cs b/Basis/Packages/com.basis.framework/UI Panels/BasisDataStoreAvatarKeys.cs index be3c12289..c06777102 100644 --- a/Basis/Packages/com.basis.framework/UI Panels/BasisDataStoreAvatarKeys.cs +++ b/Basis/Packages/com.basis.framework/UI Panels/BasisDataStoreAvatarKeys.cs @@ -1,4 +1,5 @@ using BasisSerializer.OdinSerializer; +using System; using System.Collections.Generic; using System.IO; using System.Threading.Tasks; @@ -14,8 +15,13 @@ public class AvatarKey public string Url; public string Pass; } +#if UNITY_EDITOR || UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || UNITY_STANDALONE_LINUX + private static string directory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), Application.companyName, Application.productName); + public static string FilePath = Path.Combine(directory, "KeyStore.json"); +#else public static string FilePath = Path.Combine(Application.persistentDataPath, "KeyStore.json"); - + +#endif [SerializeField] private static List keys = new List(); @@ -63,6 +69,17 @@ public static async Task LoadKeys() else { BasisDebug.Log("No key file found. Starting fresh."); +#if UNITY_EDITOR || UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || UNITY_STANDALONE_LINUX + if (!Directory.Exists(directory)) + { + Directory.CreateDirectory(directory); + } + string checkMigration = Path.Combine(Application.persistentDataPath, "KeyStore.json"); + if (File.Exists(checkMigration)) + { + File.Copy(checkMigration, FilePath); + } +#endif } } @@ -70,6 +87,12 @@ private static async Task SaveKeysToFile() { try { +#if UNITY_EDITOR || UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || UNITY_STANDALONE_LINUX + if (!Directory.Exists(directory)) + { + Directory.CreateDirectory(directory); + } +#endif byte[] byteData = SerializationUtility.SerializeValue>(keys, DataFormat.Binary); await File.WriteAllBytesAsync(FilePath, byteData); BasisDebug.Log($"Keys saved to file at: {FilePath}"); From 3eb9bbdeb99c384351f3da3df8ab3e1a38b2ebee Mon Sep 17 00:00:00 2001 From: Toys0125 Date: Sun, 21 Dec 2025 22:34:58 -0600 Subject: [PATCH 2/4] Implement backup for keys file on save failure Add backup of the keys file when saving fails. --- .../com.basis.framework/UI Panels/BasisDataStoreAvatarKeys.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Basis/Packages/com.basis.framework/UI Panels/BasisDataStoreAvatarKeys.cs b/Basis/Packages/com.basis.framework/UI Panels/BasisDataStoreAvatarKeys.cs index be3c12289..b928232c0 100644 --- a/Basis/Packages/com.basis.framework/UI Panels/BasisDataStoreAvatarKeys.cs +++ b/Basis/Packages/com.basis.framework/UI Panels/BasisDataStoreAvatarKeys.cs @@ -77,6 +77,9 @@ private static async Task SaveKeysToFile() catch (System.Exception e) { BasisDebug.LogError($"Failed to save keys: {e.Message}"); + if (File.Exists(FilePath)) { + File.Copy(FilePath, Path.ChangeExtension(FilePath, ".json.bak")); + } } } From 4e351af15014de9e3d6ffe47e34fe86c607ff02e Mon Sep 17 00:00:00 2001 From: Toys0125 Date: Mon, 22 Dec 2025 17:13:33 -0600 Subject: [PATCH 3/4] Fixed multiline support for the Warning Label, and Issue Label --- .../Scripts/Editor/BasisAvatarValidator.cs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Basis/Packages/com.basis.sdk/Scripts/Editor/BasisAvatarValidator.cs b/Basis/Packages/com.basis.sdk/Scripts/Editor/BasisAvatarValidator.cs index f2b2f0ef0..c4b9dc37a 100644 --- a/Basis/Packages/com.basis.sdk/Scripts/Editor/BasisAvatarValidator.cs +++ b/Basis/Packages/com.basis.sdk/Scripts/Editor/BasisAvatarValidator.cs @@ -488,7 +488,7 @@ public static bool ReportIfNoIll2CPP() } private void ShowErrorPanel(VisualElement Root, List errors) { - string IssueList = string.Empty; + List IssueList = new List(); for (int Index = 0; Index < errors.Count; Index++) { BasisValidationIssue issue = errors[Index]; @@ -497,9 +497,12 @@ private void ShowErrorPanel(VisualElement Root, List error { AutoFixButton(Root, ActFix, issue.Message); } - IssueList += issue.Message; + if (!IssueList.Exists(i => i == issue.Message)) + { + IssueList.Add(issue.Message); + } } - errorMessageLabel.text = string.Join("\n", IssueList); + errorMessageLabel.text = string.Join("\n", IssueList.ToArray()); errorPanel.style.display = DisplayStyle.Flex; } private void HideErrorPanel() @@ -508,7 +511,7 @@ private void HideErrorPanel() } private void ShowWarningPanel(VisualElement Root,List warnings) { - string warningsList = string.Empty; + List warningsList = new List(); for (int Index = 0; Index < warnings.Count; Index++) { BasisValidationIssue issue = warnings[Index]; @@ -517,9 +520,12 @@ private void ShowWarningPanel(VisualElement Root,List warn { AutoFixButton(Root, ActFix, issue.Message); } - warningsList += issue.Message; + if (!warningsList.Exists(i => i==issue.Message)) + { + warningsList.Add(issue.Message); + } } - warningMessageLabel.text = string.Join("\n", warningsList); + warningMessageLabel.text = string.Join("\n", warningsList.ToArray()); warningPanel.style.display = DisplayStyle.Flex; } public void ClearFixButtons(VisualElement rootElement) From 775d2209457a21fdb33da4c23ffe22ecd48c2602 Mon Sep 17 00:00:00 2001 From: Toys0125 Date: Mon, 22 Dec 2025 20:21:40 -0600 Subject: [PATCH 4/4] Remove Linux as a platform that will use my documents. --- .../UI Panels/BasisDataStoreAvatarKeys.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Basis/Packages/com.basis.framework/UI Panels/BasisDataStoreAvatarKeys.cs b/Basis/Packages/com.basis.framework/UI Panels/BasisDataStoreAvatarKeys.cs index 90787e4b7..50c207ae6 100644 --- a/Basis/Packages/com.basis.framework/UI Panels/BasisDataStoreAvatarKeys.cs +++ b/Basis/Packages/com.basis.framework/UI Panels/BasisDataStoreAvatarKeys.cs @@ -15,7 +15,7 @@ public class AvatarKey public string Url; public string Pass; } -#if UNITY_EDITOR || UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || UNITY_STANDALONE_LINUX +#if UNITY_EDITOR_WIN || UNITY_EDITOR_OSX || UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX private static string directory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), Application.companyName, Application.productName); public static string FilePath = Path.Combine(directory, "KeyStore.json"); #else @@ -69,7 +69,7 @@ public static async Task LoadKeys() else { BasisDebug.Log("No key file found. Starting fresh."); -#if UNITY_EDITOR || UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || UNITY_STANDALONE_LINUX +#if UNITY_EDITOR_WIN || UNITY_EDITOR_OSX || UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX if (!Directory.Exists(directory)) { Directory.CreateDirectory(directory); @@ -87,7 +87,7 @@ private static async Task SaveKeysToFile() { try { -#if UNITY_EDITOR || UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || UNITY_STANDALONE_LINUX +#if UNITY_EDITOR_WIN || UNITY_EDITOR_OSX || UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX if (!Directory.Exists(directory)) { Directory.CreateDirectory(directory);