Skip to content

Commit d895491

Browse files
committed
fix bugs
1 parent 58cd287 commit d895491

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

Assets/BundleBuildTool/Src/Editor/BundleHelper/BundleDataManager.cs

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public static bool CanAddPathToBundle(string path, string bundleName)
113113
return false;
114114
}
115115

116-
string guid = AssetDatabase.AssetPathToGUID(path);
116+
string guid = GetPathGUID(path);
117117
if (m_guidToBundle.ContainsKey(guid))
118118
{
119119
return false;
@@ -134,7 +134,7 @@ public static bool AddPathToBundle(string path, string bundleName, int size)
134134
}
135135

136136
BundleData bundle = m_dataDict[bundleName];
137-
string guid = AssetDatabase.AssetPathToGUID(path);
137+
string guid = GetPathGUID(path);
138138

139139
bundle.includs.Add(path);
140140
m_guidToBundle.Add(guid, bundleName);
@@ -149,7 +149,7 @@ public static void RemovePathFromBundle(string path, string bundleName)
149149
{
150150
return;
151151
}
152-
string guid = AssetDatabase.AssetPathToGUID(path);
152+
string guid = GetPathGUID(path);
153153

154154
if (m_guidToBundle.ContainsKey(guid))
155155
{
@@ -158,7 +158,7 @@ public static void RemovePathFromBundle(string path, string bundleName)
158158

159159
for (int i = 0; i < bundle.includs.Count; ++i)
160160
{
161-
string nGuid = AssetDatabase.AssetPathToGUID(bundle.includs[i]);
161+
string nGuid = GetPathGUID(bundle.includs[i]);
162162
if (nGuid == guid)
163163
{
164164
bundle.includs.RemoveAt(i);
@@ -185,7 +185,7 @@ public static bool RemoveBundle(string bundleName)
185185

186186
for (int i = 0; i < bundle.includs.Count; ++i)
187187
{
188-
string nGuid = AssetDatabase.AssetPathToGUID(bundle.includs[i]);
188+
string nGuid = GetPathGUID(bundle.includs[i]);
189189
m_guidToBundle.Remove(nGuid);
190190
}
191191

@@ -235,17 +235,25 @@ public static string GenBundleNameByType(BundleType type)
235235
}
236236
public static string GetPathBundleName(string assetPath)
237237
{
238-
string guid = AssetDatabase.AssetPathToGUID(assetPath);
238+
string guid = GetPathGUID(assetPath);
239239
string ret = string.Empty;
240240
if (m_guidToBundle.TryGetValue(guid, out ret))
241241
{
242242
return ret;
243243
}
244244
return string.Empty;
245245
}
246+
public static string GetPathGUID(string path)
247+
{
248+
if (path.StartsWith("Assets/", System.StringComparison.OrdinalIgnoreCase))
249+
{
250+
return AssetDatabase.AssetPathToGUID(path);
251+
}
252+
return path;
253+
}
246254
public static bool CheckPathInBundle(string path)
247255
{
248-
string guid = AssetDatabase.AssetPathToGUID(path);
256+
string guid = GetPathGUID(path);
249257
return m_guidToBundle.ContainsKey(guid);
250258
}
251259
public static bool IsBundleFull(BundleData bundle, int maxCount, int memSize)
@@ -309,7 +317,7 @@ public static void Init()
309317

310318
for (int i = 0; i < bundleData.includs.Count; ++i)
311319
{
312-
string guid = AssetDatabase.AssetPathToGUID(bundleData.includs[i]);
320+
string guid = GetPathGUID(bundleData.includs[i]);
313321
if (!m_guidToBundle.ContainsKey(guid))
314322
{
315323
m_guidToBundle.Add(guid, bundleData.name);

Assets/BundleBuildTool/Src/Editor/BundleImport/BundleAdapter.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ public static void BuildBundles()
8888

8989
BundleBuildHelper.PopAssetDependencies();
9090

91+
BundleDataAccessor.SaveData();
9192
BundleExport.ExportBundleMainfestToOutput();
9293

9394
AssetDatabase.SaveAssets();
@@ -110,7 +111,7 @@ private static void BuildSingleBundle(string name, BundleImportData data)
110111
{
111112
continue;
112113
}
113-
if (m_buildAll && !m_bundleDict.ContainsKey(child.name))
114+
if (!m_buildAll && !m_bundleDict.ContainsKey(child.name))
114115
{
115116
continue;
116117
}

Assets/BundleBuildTool/Src/Editor/BundleImport/BundleDataControl.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ public void RefreshDataByRootPath(string path)
170170
}
171171
private void RefreshList(List<string> list)
172172
{
173+
m_pathInfoList.Clear();
173174
for (int i = 0; i < list.Count; ++i)
174175
{
175176
string path = EditorPath.FormatAssetPath(list[i]);

0 commit comments

Comments
 (0)