Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
## [1.17.13] - 2021-03-10
- Fixed issue when loading a Sprite from a SpriteAtlas from an Addressable folder in AssetDatabase mode.
- Fixed bug in AssetReference "Make Addressable" functionality (when referencing an asset no longer addressable)
- Fixed bug with cyclic references in profile variable causing an infinite loop.
- Fixed bug where cached asset type could get stuck with DefaultType, an invalid Editor type
- Fixed issue where AsyncOperationHandle.Completed is called after AsyncOperationHandle.Task returns when the handle is already done.
- Fixed some faulty logic in GetDownloadStatus() when errors occur
- Removed extra dependencies that were being flagged as modified when running Check For Content Update Restrictions.
- Fixed a bug where the result of a Task could be inconsistent and return null given certain race conditions
- Fixed bug where UnloadSceneAsync decreased ref count more than once, and added unload scene to Release if ref count goes to zero
- Fixed issue where a popup appears when an AddressableAsset file is being modified even if the file is checked out locally.
- Fixed bug where fast mode wasn't showing events in the profiler
- Remove check for isUpdating and isCompiling so GetSettings(true) still tries to load the settings when compiling or updating
- Fixed issue where modified local static bundle dependencies fail to load after updating a previous build. Fix is compatible with older shipped content.
  • Loading branch information
Unity Technologies committed Mar 10, 2021
1 parent 4d68eb2 commit e45390b
Show file tree
Hide file tree
Showing 55 changed files with 1,441 additions and 308 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@ All notable changes to this package will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [1.17.13] - 2021-03-10
- Fixed issue when loading a Sprite from a SpriteAtlas from an Addressable folder in AssetDatabase mode.
- Fixed bug in AssetReference "Make Addressable" functionality (when referencing an asset no longer addressable)
- Fixed bug with cyclic references in profile variable causing an infinite loop.
- Fixed bug where cached asset type could get stuck with DefaultType, an invalid Editor type
- Fixed issue where AsyncOperationHandle.Completed is called after AsyncOperationHandle.Task returns when the handle is already done.
- Fixed some faulty logic in GetDownloadStatus() when errors occur
- Removed extra dependencies that were being flagged as modified when running Check For Content Update Restrictions.
- Fixed a bug where the result of a Task could be inconsistent and return null given certain race conditions
- Fixed bug where UnloadSceneAsync decreased ref count more than once, and added unload scene to Release if ref count goes to zero
- Fixed issue where a popup appears when an AddressableAsset file is being modified even if the file is checked out locally.
- Fixed bug where fast mode wasn't showing events in the profiler
- Remove check for isUpdating and isCompiling so GetSettings(true) still tries to load the settings when compiling or updating
- Fixed issue where modified local static bundle dependencies fail to load after updating a previous build. Fix is compatible with older shipped content.

## [1.17.6-preview] - 2021-02-23
- Fixed issue where OnGlobalModification events would be EntryMoved when adding new Entries instead of EntryAdded.
- Fixed issue where a previously built player fails to load content after running Content Update with missing local bundles
Expand Down Expand Up @@ -79,6 +94,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- The "Ignore Invalid/Unsupported Files" option is now saved in the settings
- Fixed issue where Filename only bundle naming schemas were overwriting old bundles prematurely in content update.

## [1.16.17] - 2021-02-25
- Updated group rename logic to support engine AssetDatabase fix. Change should be transparent to users.

## [1.16.16] - 2021-01-20
- Updated dependency versions for testcase fix

Expand Down
4 changes: 2 additions & 2 deletions Documentation~/ContentUpdateWorkflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ When loading AssetBundles into memory, Unity enforces that two bundles cannot be
To make this work, one of two things must happen. One option is to unload all your Addressables content prior to updating the catalog. This ensures new bundles with old names will not cause conflicts in memory. The second option is to ensure that your updated AssetBundles have unique internal identifiers. This would allow you to load new bundles, while the old are still in memory. We have an option to enable this second option. Turn on "Unique Bundle IDs" within the [`AddressableAssetSettings`](xref:UnityEditor.AddressableAssets.Settings.AddressableAssetSettings) Inspector. The downside of this option is that it requires bundles to be rebuilt up the dependency chain. Meaning if you changed a material in one group, by default only the material's bundle would be rebuilt. With "Unique Bundle IDs" on, any Asset that references that material would also need rebuilding.

## Identifying changed assets
If you have modified Assets in any `Cannot Change Post Release` groups, you'll need to run the **Check for Content Update Restrictions** command (step 5 above). This will take any modified Asset, all of its dependencies, and all other Assets that depend on the modified Asset out of the `Cannot Change Post Release` groups and move them to a new group. To generate the new Asset groups:
If you have modified Assets in any `Cannot Change Post Release` groups, you'll need to run the **Check for Content Update Restrictions** command (step 5 above). This will take any modified Asset, its dependencies if their bundle name was modified, and all other Assets that depend on the modified Asset out of the `Cannot Change Post Release` groups and move them to a new group. To generate the new Asset groups:

1. Open the **Addressables Groups** window in the Unity Editor (**Window** > **Asset Management** > **Addressables** > **Groups**).
2. In the **Addressables Groups** window, select **Tools** on the top menu bar, then **Check for Content Update Restrictions**.
3. In the **Build Data File** dialog that opens, select the _addressables_content_state.bin_ file (by default, this is located in the `Assets/AddressableAssetsData/\<platform\>` Project directory, where `\<platform\>` is your target platform).

This data is used to determine which Assets or dependencies have been modified since the application was last built. The system moves these Assets, their dependencies, and all other Assets that depend on the modified Assets to a new group in preparation for the content update build.
This data is used to determine which Assets or dependencies have been modified since the application was last built. The system moves these Assets, their dependencies if their bundle name was modified, and all other Assets that depend on the modified Assets to a new group in preparation for the content update build.

**Note**: This command will do nothing if all your changes are confined to `Can Change Post Release` groups.

Expand Down
4 changes: 4 additions & 0 deletions Documentation~/SynchronousAddressables.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ It is possible to get a `default(TObject)` for a result when the operation doesn
## Performance
It is worth noting that calling `WaitForCompletion` may have performance implications on your runtime when compared to `Resources.Load` or `Instantiate` calls directly. If your `AssetBundle` is local or has been previously downloaded and cached, these performance hits are likely to be negligible. However, this may not be the case for your individual project setup.

All currently active Asset Load operations are completed when `WaitForCompletion` is called on any Asset Load operation, due to how Async operations are handled in the Engine. To avoid unexpected stalls, use `WaitForCompletion` when the current operation count is known, and the intention is for all active operations to complete synchronously.

When using `WaitForCompletion`, there are performance implications. When using 2021.2.0 or newer, these are minimal. Using an older version can result in delays that scale with the number of Engine Asset load calls that are loading when `WaitForCompletion` is called.

It is not recommended that you call `WaitForCompletion` on an operation that is going to fetch and download a remote `AssetBundle`. Though, it is possible if that fits your specific situation.

## Code Sample
Expand Down
40 changes: 20 additions & 20 deletions Documentation~/TableOfContents.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
* [Profile Setup](AddressableAssetsProfiles.md#profile-setup)
* [Specifying packing and loading paths](AddressableAssetsProfiles.md#specifying-packing-and-loading-paths)
* [Examples](AddressableAssetsProfiles.md#examples)
* [Synchronous Addressables](SynchronousAddressables.md)
* [Asset Hosting Services](AddressableAssetsHostingServices.md)
* [Overview](AddressableAssetsHostingServices.md#overview)
* [Setup](AddressableAssetsHostingServices.md#setup)
Expand All @@ -44,30 +45,29 @@
* [The direct reference method](AddressableAssetsMigrationGuide.md#the-direct-reference-method)
* [The Resource folders method](AddressableAssetsMigrationGuide.md#the-resource-folders-method)
* [The AssetBundles method](AddressableAssetsMigrationGuide.md#the-assetbundles-method)
* [Expanded API documentation](AddressablesAPI.md)
* [BuildPlayerContent](BuildPlayerContent.md)
* [DownloadDependenciesAsync](DownloadDependenciesAsync.md)
* [ExceptionHandler](ExceptionHandler.md)
* [InitializeAsync](InitializeAsync.md)
* [InstantiateAsync](InstantiateAsync.md)
* [LoadContentCatalogAsync](LoadContentCatalogAsync.md)
* [LoadingAddressableAssets](LoadingAddressableAssets.md)
* [LoadResourceLocationsAsync](LoadResourceLocations.md)
* [LoadSceneAsync](LoadSceneAsync.md)
* [TransformInternalId](TransformInternalId.md)
* [UpdateCatalogs](UpdateCatalogs.md)
* [Diagnostic Tools](DiagnosticTools.md)
* [Build Layout](DiagnosticTools.md#build-layout-report)
* [Build Profiling](DiagnosticTools.md#build-profiling)
* [The Addressables Analyze tool](DiagnosticTools.md#the-addressables-analyze-tool)
* [Using Analyze](DiagnosticTools.md#using-analyze)
* [Provided Analyze rules](DiagnosticTools.md#provided-analyze-rules)
* [Extending Analyze](DiagnosticTools.md#extending-analyze)
* [FAQ](AddressablesFAQ.md)
* [Many vs few bundles](AddressablesFAQ.md#Is-it-better-to-have-many-small-bundles-or-a-few-bigger-ones)
* [Best compression settings](AddressablesFAQ.md#What-compression-settings-are-best)
* [Minimize catlog size](AddressablesFAQ.md#Are-there-ways-to-miminize-the-catalog-size)
* [Addressables content state](AddressablesFAQ.md#What-is-addressables_content_state)
* [Scale implications](AddressablesFAQ.md#What-are-possible-scale-implications)
* [Synchronous Addressables](SynchronousAddressables.md)
* [FAQ](AddressablesFAQ.md)
* [Many vs few bundles](AddressablesFAQ.md#Is-it-better-to-have-many-small-bundles-or-a-few-bigger-ones)
* [Best compression settings](AddressablesFAQ.md#What-compression-settings-are-best)
* [Minimize catlog size](AddressablesFAQ.md#Are-there-ways-to-miminize-the-catalog-size)
* [Addressables content state](AddressablesFAQ.md#What-is-addressables_content_state)
* [Scale implications](AddressablesFAQ.md#What-are-possible-scale-implications)
* [Address Lookup](AddressablesFAQ.md#is-it-possible-to-retrieve-the-address-of-an-asset-or-reference-at-runtime)
* [Expanded API documentation](AddressablesAPI.md)
* [BuildPlayerContent](BuildPlayerContent.md)
* [DownloadDependenciesAsync](DownloadDependenciesAsync.md)
* [ExceptionHandler](ExceptionHandler.md)
* [InitializeAsync](InitializeAsync.md)
* [InstantiateAsync](InstantiateAsync.md)
* [LoadContentCatalogAsync](LoadContentCatalogAsync.md)
* [LoadingAddressableAssets](LoadingAddressableAssets.md)
* [LoadResourceLocationsAsync](LoadResourceLocations.md)
* [LoadSceneAsync](LoadSceneAsync.md)
* [TransformInternalId](TransformInternalId.md)
* [UpdateCatalogs](UpdateCatalogs.md)
10 changes: 3 additions & 7 deletions Editor/AddressableAssetSettingsDefaultObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ public class AddressableAssetSettingsDefaultObject : ScriptableObject
/// The name of the default config object
/// </summary>
public const string kDefaultConfigObjectName = "com.unity.addressableassets";
/// <summary>
/// The path to the Library folder for storing Addressables data
/// </summary>
internal const string kAddressablesLibraryPath = "Library/com.unity.addressables";

/// <summary>
/// Default path for addressable asset settings assets.
Expand Down Expand Up @@ -110,7 +106,7 @@ public static AddressableAssetSettings Settings
{
get
{
if (s_DefaultSettingsObject == null && !EditorApplication.isUpdating && !EditorApplication.isCompiling)
if (s_DefaultSettingsObject == null)
{
AddressableAssetSettingsDefaultObject so;
if (EditorBuildSettings.TryGetConfigObject(kDefaultConfigObjectName, out so))
Expand All @@ -127,7 +123,7 @@ public static AddressableAssetSettings Settings
so.SetSettingsObject(s_DefaultSettingsObject);
AssetDatabase.CreateAsset(so, kDefaultConfigFolder + "/DefaultObject.asset");
EditorUtility.SetDirty(so);
AddressableAssetUtility.OpenAssetIfUsingVCIntegration(so, kDefaultConfigFolder + "/DefaultObject.asset");
AddressableAssetUtility.OpenAssetIfUsingVCIntegration(kDefaultConfigFolder + "/DefaultObject.asset");
AssetDatabase.SaveAssets();
EditorBuildSettings.AddConfigObject(kDefaultConfigObjectName, so, true);
}
Expand Down Expand Up @@ -158,7 +154,7 @@ public static AddressableAssetSettings Settings
}
so.SetSettingsObject(s_DefaultSettingsObject);
EditorUtility.SetDirty(so);
AddressableAssetUtility.OpenAssetIfUsingVCIntegration(so, kDefaultConfigFolder + "/DefaultObject.asset");
AddressableAssetUtility.OpenAssetIfUsingVCIntegration(kDefaultConfigFolder + "/DefaultObject.asset");
AssetDatabase.SaveAssets();
}
}
Expand Down
19 changes: 16 additions & 3 deletions Editor/Build/AddressableAssetSettingsLocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,23 @@
using UnityEngine.AddressableAssets.ResourceLocators;
using UnityEngine.ResourceManagement.ResourceLocations;
using UnityEngine.ResourceManagement.ResourceProviders;
using UnityEngine.U2D;
using static UnityEditor.AddressableAssets.Settings.AddressablesFileEnumeration;

namespace UnityEditor.AddressableAssets.Settings
{
internal class AddressableAssetSettingsLocator : IResourceLocator
{
private static Type m_SpriteType = typeof(Sprite);
private static Type m_SpriteAtlasType = typeof(SpriteAtlas);

public string LocatorId { get; private set; }
public Dictionary<object, List<AddressableAssetEntry>> m_keyToEntries;
public Dictionary<CacheKey, IList<IResourceLocation>> m_Cache;
public AddressableAssetTree m_AddressableAssetTree;
HashSet<object> m_Keys = null;
AddressableAssetSettings m_Settings;

public IEnumerable<object> Keys
{
get
Expand Down Expand Up @@ -258,7 +262,11 @@ public bool Locate(object key, Type type, out IList<IResourceLocation> locations

if (m_keyToEntries.ContainsKey(parentFolderKey))
{
locations.Add(new ResourceLocationBase(keyPath, AssetDatabase.GUIDToAssetPath(keyStr), typeof(AssetDatabaseProvider).FullName, type));
string keyAssetPath = AssetDatabase.GUIDToAssetPath(keyStr);
if (type == m_SpriteType && AssetDatabase.GetMainAssetTypeAtPath(keyAssetPath) == m_SpriteAtlasType)
locations.Add(new ResourceLocationBase(keyPath, keyAssetPath, typeof(AssetDatabaseProvider).FullName, m_SpriteAtlasType));
else
locations.Add(new ResourceLocationBase(keyPath, keyAssetPath, typeof(AssetDatabaseProvider).FullName, type));
break;
}
slash = keyPath.LastIndexOf('/');
Expand All @@ -279,7 +287,12 @@ public bool Locate(object key, Type type, out IList<IResourceLocation> locations
{
var internalId = GetInternalIdFromFolderEntry(keyStr, e);
if (!string.IsNullOrEmpty(internalId) && !string.IsNullOrEmpty(AssetDatabase.AssetPathToGUID(internalId)))
locations.Add(new ResourceLocationBase(keyStr, internalId, typeof(AssetDatabaseProvider).FullName, type));
{
if (type == m_SpriteType && AssetDatabase.GetMainAssetTypeAtPath(internalId) == m_SpriteAtlasType)
locations.Add(new ResourceLocationBase(keyStr, internalId, typeof(AssetDatabaseProvider).FullName, m_SpriteAtlasType));
else
locations.Add(new ResourceLocationBase(keyStr, internalId, typeof(AssetDatabaseProvider).FullName, type));
}
}
break;
}
Expand Down
2 changes: 1 addition & 1 deletion Editor/Build/AnalyzeRules/AnalyzeSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ internal static string AnalyzeRuleDataFolder
{
get
{
return $"{AddressableAssetSettingsDefaultObject.kAddressablesLibraryPath}/AnalyzeData";
return $"{Addressables.LibraryPath}/AnalyzeData";
}
}

Expand Down
23 changes: 16 additions & 7 deletions Editor/Build/AnalyzeRules/BundleRuleBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
using UnityEditor.Build.Pipeline;
using UnityEditor.Build.Pipeline.Interfaces;
using UnityEditor.Build.Pipeline.Tasks;
using UnityEditor.SceneManagement;
using UnityEngine;
using UnityEngine.AddressableAssets.Initialization;
using UnityEngine.AddressableAssets.ResourceLocators;
Expand Down Expand Up @@ -137,10 +136,16 @@ internal virtual void BuiltInResourcesToDependenciesMap(string[] resourcePaths)
string[] dependencies = AssetDatabase.GetDependencies(path);

if (!m_ResourcesToDependencies.ContainsKey(path))
m_ResourcesToDependencies.Add(path, new List<GUID>());

m_ResourcesToDependencies[path].AddRange(from dependency in dependencies
select new GUID(AssetDatabase.AssetPathToGUID(dependency)));
m_ResourcesToDependencies.Add(path, new List<GUID>(dependencies.Length));
else
m_ResourcesToDependencies[path].Capacity += dependencies.Length;

foreach (string dependency in dependencies)
{
if (dependency.EndsWith(".cs") || dependency.EndsWith(".dll"))
continue;
m_ResourcesToDependencies[path].Add(new GUID(AssetDatabase.AssetPathToGUID(dependency)));
}
}
}

Expand Down Expand Up @@ -204,12 +209,16 @@ internal void CalculateInputDefinitions(AddressableAssetSettings settings)
}
}
}

internal AssetBundleBuild CreateUniqueBundle(AssetBundleBuild bid)
{
return CreateUniqueBundle(bid, m_BundleToAssetGroup);
}

internal static AssetBundleBuild CreateUniqueBundle(AssetBundleBuild bid, Dictionary<string, string> bundleToAssetGroup)
{
int count = 1;
var newName = bid.assetBundleName;
while (m_BundleToAssetGroup.ContainsKey(newName) && count < 1000)
while (bundleToAssetGroup.ContainsKey(newName) && count < 1000)
newName = bid.assetBundleName.Replace(".bundle", string.Format("{0}.bundle", count++));
return new AssetBundleBuild
{
Expand Down
Loading

0 comments on commit e45390b

Please sign in to comment.