Skip to content

Commit

Permalink
fixed sync refresh issue
Browse files Browse the repository at this point in the history
  • Loading branch information
michael811125 committed Aug 29, 2022
1 parent 3add6c7 commit cf9b09b
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog (unofficial)

## [1.5.1] - 2022-08-29
- Fixed when enabled sync has refresh issue (do refresh all or refresh specific).

## [1.5.0] - 2022-08-29
- Added Sync feature for BuildMap. When drag a bundle to BuildMap can sync to specified BuildMap.
- Added namespace AssetBundleBrowser.AssetBundleDataSource for BundleBuildMap class.
Expand Down
11 changes: 11 additions & 0 deletions Editor/AssetBundleBrowserMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,17 @@ public static void ReloadBuildMapDataSource()
{
if (typeof(BundleBuildMap).IsInstanceOfType(AssetBundleModel.Model.DataSource))
{
// sync to specified buildMap
if ((AssetBundleModel.Model.DataSource as BundleBuildMap).enableBundleSync)
{
foreach (var bundleSyncMap in (AssetBundleModel.Model.DataSource as BundleBuildMap).bundleSyncMaps.ToArray())
{
if (!bundleSyncMap.sync || bundleSyncMap.bundleBuildMap == null) continue;
bundleSyncMap.bundleBuildMap.RefreshAllAssetBundle();
}
}

// last refresh current data source
(AssetBundleModel.Model.DataSource as BundleBuildMap).RefreshAllAssetBundle();
}
}
Expand Down
18 changes: 16 additions & 2 deletions Editor/BundleBuildMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ private BuildBundleInfo _GetBuildBundleInfoByBundleNameWithSimilarAssetPath(stri
if (samples.Count > 0)
{
decimal max = samples.Keys.Max();
Debug.Log($"<color=#FFE733>BundleName: {bundleName},</color> <color=#FF9933>Most Similar ({(max * 100).ToString("f2")}%) => Replace</color> <color=#33D6FF>old AssetPath: {samples[max].assetPath}</color> <color=#FF9933>to</color> <color=#A4FF33>new AssetPath:{tAssetPath}</color>");
Debug.Log($"<color=#FF1FF9>DataSourceName: {this.sourceName},</color> <color=#FFE733>BundleName: {bundleName},</color> <color=#FF9933>Most Similar ({(max * 100).ToString("f2")}%) => Replace</color> <color=#33D6FF>old AssetPath: {samples[max].assetPath}</color> <color=#FF9933>to</color> <color=#A4FF33>new AssetPath:{tAssetPath}</color>");
return samples[max];
}

Expand Down Expand Up @@ -387,7 +387,21 @@ internal void RefreshAllAssetBundle(IEnumerable<BundleInfo> bundles)
}
}

if (bundleNames.Count > 0) this.RefreshAllAssetBundle(bundleNames.ToArray());
if (bundleNames.Count > 0)
{
// sync to specified buildMap
if (this.enableBundleSync)
{
foreach (var bundleSyncMap in this.bundleSyncMaps.ToArray())
{
if (!bundleSyncMap.sync || bundleSyncMap.bundleBuildMap == null) continue;
bundleSyncMap.bundleBuildMap.RefreshAllAssetBundle(bundleNames.ToArray());
}
}

// last refresh current data source
this.RefreshAllAssetBundle(bundleNames.ToArray());
}
}

public CustomBuildMap[] GetCustomBuildMaps()
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ When switch data source if has exclamation mark messages you can right-click on

### Sync Bundle To Specified BuildMap

When enabled sync feature, recommend refresh specific a bundle instead of refresh all.

![](https://github.com/michael811125/AssetBundles-Browser-Plus/blob/master/Documentation/images/desc_img_8.gif)

# Installation
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"name": "com.unity.assetbundlebrowser.plus",
"displayName": "Asset Bundle Browser Plus",
"version": "1.5.0",
"version": "1.5.1",
"unity": "2018.1",
"description": "The Asset Bundle Browser tool enables the user to view and edit the configuration of asset bundles for their Unity project. It will block editing that would create invalid bundles, and inform you of any issues with existing bundles. It also provides basic build functionality.\n\nUse this tool as an alternative to selecting assets and setting their asset bundle manually in the inspector. It can be dropped into any Unity project with a version of 5.6 or greater. It will create a new menu item in Window > AssetBundle Browser. The bundle configuration, build functionality, and built-bundle inspection are split into three tabs within the new window.",
"keywords": ["asset", "bundle", "bundles", "assetbundles"],
Expand Down

0 comments on commit cf9b09b

Please sign in to comment.