Skip to content
This repository was archived by the owner on Jul 11, 2023. It is now read-only.

Commit da9f895

Browse files
committed
修复更新资源的Package Path问题
1 parent 0847046 commit da9f895

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

GameFramework/Editor/AddressablesEditor/AddressablesEditor.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using System.Text;
88
using UnityEditor.AddressableAssets.Settings;
99
using System.IO;
10+
using UnityEditor.AddressableAssets.Settings.GroupSchemas;
1011

1112
namespace Wanderer.GameFramework
1213
{
@@ -38,7 +39,18 @@ public static string ShellBuild(string activeProfileId = "Default")
3839
//将被修改过的资源单独分组
3940
var groupName = string.Format("UpdateGroup_{0}#", System.DateTime.Now.ToString("yyyyMMdd"));
4041
ContentUpdateScript.CreateContentUpdateGroup(settings, entries, groupName);
42+
var group= settings.FindGroup(groupName);
43+
BundledAssetGroupSchema bagSchema = group.GetSchema<BundledAssetGroupSchema>();
44+
if (bagSchema == null)
45+
{
46+
bagSchema = group.AddSchema<BundledAssetGroupSchema>();
47+
}
48+
var defultBAGSchema = settings.DefaultGroup.GetSchema<BundledAssetGroupSchema>();
49+
50+
bagSchema.BuildPath.SetVariableByName(settings, defultBAGSchema.BuildPath.GetValue(settings));
51+
bagSchema.LoadPath.SetVariableByName(settings, defultBAGSchema.LoadPath.GetValue(settings));
4152
Debug.Log($"Update content:{@string}");
53+
EditorUtility.SetDirty(settings);
4254
AssetDatabase.Refresh();
4355
}
4456

0 commit comments

Comments
 (0)