We have a pretty large dataset in addressable. When entering play mode, the method ExtractAddressablePaths in AddressablesFileEnumeration.cs creats over 100MB garbage and takes multiple seconds at the Directory.Exists call.
In fact the cause is the large dataset. But exchanging the Directory.Exists call with AssetDatabase.IsValidFolder improves this process a lot resulting in a much faster switch to play mode.
Maybe this is an easy improvement you could at to the next version of addressables after checking that this is a valid change.
Similarly, we are also having performance issues with one of our Addressable Groups.
This particular one contains 50 or so addressable folders as follows :
While it would take 10 to 20 seconds before, it now takes a whooping 4 minutes to process the group (either when entering play mode with a custom build script (sync addressables), or just when trying to inspect the group in the Addressables Group window). Most of the processing time seems to be spent in AddressablesFileEnumeration.EnumerateAddressableFolder when the build script calls GatherAllAssets for each entry.
We were considering using the AddressablesFileEnumerationCache but cannot since it’s an internal class.
The issue appeared when upgrading from 1.11 to 1.13.
I really hate doing this, but it decreases our loading time from 5 min 30sec, to 30 sec… @davidla_unity is there a proper way to replicate this behavior without having to hack into the internal addressable classes?
string absolutePath = System.IO.Path.Combine(Application.dataPath, "../Library/ScriptAssemblies/Unity.Addressables.Editor.dll");
Assembly ass = Assembly.LoadFile(absolutePath);
Type asmType = ass.GetType("UnityEditor.AddressableAssets.Settings.AddressablesFileEnumeration");
MethodInfo begin = asmType.GetMethod("BeginPrecomputedEnumerationSession", BindingFlags.NonPublic | BindingFlags.Static);
MethodInfo end = asmType.GetMethod("EndPrecomputedEnumerationSession", BindingFlags.NonPublic | BindingFlags.Static);
object[] parameters = new object[] { aaSettings, true, null };
begin.Invoke(null, parameters);
var errorString = ProcessAllGroups(aaContext);
end.Invoke(null, null);
This code sample is used in our custom BuildScript (derived from SyncAddressables).