diff --git a/Packages/Sequence-Unity/Sequence/SequenceSDK/Config/SequenceConfig.cs b/Packages/Sequence-Unity/Sequence/SequenceSDK/Config/SequenceConfig.cs index 92f10b75..3c3ec1cd 100644 --- a/Packages/Sequence-Unity/Sequence/SequenceSDK/Config/SequenceConfig.cs +++ b/Packages/Sequence-Unity/Sequence/SequenceSDK/Config/SequenceConfig.cs @@ -1,6 +1,7 @@ using System; using NUnit.Framework; using NUnit.Framework.Internal; +using UnityEditor; using UnityEngine; using UnityEngine.Serialization; @@ -38,7 +39,12 @@ public static SequenceConfig GetConfig() { if (_config == null) { - _config = Resources.Load("SequenceConfig"); + _config = LoadConfig(); + if (_config == null) + { + throw new Exception("SequenceConfig not found. Make sure to create and configure it and place it at the root of your Resources folder. Create it from the top bar with Assets > Create > Sequence > SequenceConfig"); + } + TextAsset versionFile = Resources.Load("sequence-unity-version"); if (versionFile != null) { @@ -54,12 +60,26 @@ public static SequenceConfig GetConfig() #endif } - if (_config == null) + return _config; + } + + private static SequenceConfig LoadConfig() + { +#if UNITY_EDITOR + string[] guids = AssetDatabase.FindAssets($"SequenceConfig t:{nameof(SequenceConfig)}"); + foreach (string guid in guids) { - throw new Exception("SequenceConfig not found. Make sure to create and configure it and place it at the root of your Resources folder. Create it from the top bar with Assets > Create > Sequence > SequenceConfig"); + string path = AssetDatabase.GUIDToAssetPath(guid); + if (path.StartsWith("Assets")) + { + return AssetDatabase.LoadAssetAtPath(path); + } } - return _config; + return Resources.Load("SequenceConfig"); +#else + return Resources.Load("SequenceConfig"); +#endif } public static Exception MissingConfigError(string valueName) diff --git a/Packages/Sequence-Unity/package.json b/Packages/Sequence-Unity/package.json index cd5bbd65..0740f40c 100644 --- a/Packages/Sequence-Unity/package.json +++ b/Packages/Sequence-Unity/package.json @@ -1,6 +1,6 @@ { "name": "xyz.0xsequence.waas-unity", - "version": "3.17.0", + "version": "3.17.1", "displayName": "Sequence Embedded Wallet SDK", "description": "A Unity SDK for the Sequence WaaS API", "unity": "2021.3",