diff --git a/UnityProject/Assets/TEngine/Editor/GameSettings/TEngineSettingsProvider.cs b/UnityProject/Assets/TEngine/Editor/GameSettings/TEngineSettingsProvider.cs index e16d32ffd..f161009bf 100644 --- a/UnityProject/Assets/TEngine/Editor/GameSettings/TEngineSettingsProvider.cs +++ b/UnityProject/Assets/TEngine/Editor/GameSettings/TEngineSettingsProvider.cs @@ -10,6 +10,7 @@ public class TEngineSettingsProvider : SettingsProvider private const string headerName = "TEngine/TEngineSettings"; private SerializedObject m_CustomSettings; + private static string m_SettingsPath = k_SettingsPath; internal static SerializedObject GetSerializedSettings() { return new SerializedObject(SettingsUtils.GlobalSettings); @@ -17,7 +18,12 @@ internal static SerializedObject GetSerializedSettings() public static bool IsSettingsAvailable() { - return File.Exists(k_SettingsPath); + var pathes = AssetDatabase.FindAssets("TEngineGlobalSettings", new string[2] { k_SettingsPath,"Packages/com.tengine/" }); + if (pathes.Length > 0) + { + m_SettingsPath = AssetDatabase.GUIDToAssetPath(pathes[0]); + } + return pathes.Length > 0; } public override void OnActivate(string searchContext, VisualElement rootElement) @@ -29,16 +35,16 @@ public override void OnActivate(string searchContext, VisualElement rootElement) public override void OnDeactivate() { base.OnDeactivate(); - SaveAssetData(k_SettingsPath); + SaveAssetData(m_SettingsPath); } - + void SaveAssetData(string path) { - TEngineSettings old = AssetDatabase.LoadAssetAtPath(k_SettingsPath); + TEngineSettings old = AssetDatabase.LoadAssetAtPath(m_SettingsPath); TEngineSettings data = ScriptableObject.CreateInstance(); data.Set(old.FrameworkGlobalSettings, old.BybridCLRCustomGlobalSettings); AssetDatabase.DeleteAsset(path); - AssetDatabase.CreateAsset(data, path); + AssetDatabase.CreateAsset(data, path); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); }