My game is quite large and has some resources that I don’t need until later in the game, and they aren’t tied to a particular scene. I load these resources asynch during loading screens.
I was putting these assets into a /Resources directory, which worked fine until I tried making a build and found out that you can’t have more than 4GB of Resources.
The easy solution, which in hindsight I should have gone with, is to just put everything into a master scene load that scene as a substitute asset bundle. However, I am stubborn and have wasted two days trying to get a better solution.
Which brings me to the new Addressable system. In FastMode everything works fine, load speed is good, so far so good. I can’t load synchronously, which is a huge design flaw and created a lot of bad architecture but that’s another topic.
The topics for this post…
First issue: Building assets for packed play mode, I’m spammed with
Unknown Assembly ModV1
UnityEditor.Build.Content.ContentBuildInterface:GetPlayerDependenciesForObjects(ObjectIdentifier[], BuildTarget, TypeDB)
UnityEditor.Build.Pipeline.Tasks.CalculateAssetDependencyData:Run() (at Library\PackageCache\com.unity.scriptablebuildpipeline@1.5.2\Editor\Tasks\CalculateAssetDependencyData.cs:107)
UnityEditor.Build.Pipeline.BuildTasksRunner:Run(IList`1, IBuildContext) (at Library\PackageCache\com.unity.scriptablebuildpipeline@1.5.2\Editor\Shared\BuildTasksRunner.cs:50)
UnityEditor.Build.Pipeline.ContentPipeline:BuildAssetBundles(IBundleBuildParameters, IBundleBuildContent, IBundleBuildResults&, IList`1, IContextObject[]) (at Library\PackageCache\com.unity.scriptablebuildpipeline@1.5.2\Editor\ContentPipeline.cs:118)
UnityEditor.AddressableAssets.Build.DataBuilders.BuildScriptPackedMode:smile:oBuild(AddressablesDataBuilderInput, AddressableAssetsBuildContext) (at Library\PackageCache\com.unity.addressables@1.1.7\Editor\Build\DataBuilders\BuildScriptPackedMode.cs:132)
UnityEditor.AddressableAssets.Build.DataBuilders.BuildScriptPackedMode:BuildDataImplementation(AddressablesDataBuilderInput) (at Library\PackageCache\com.unity.addressables@1.1.7\Editor\Build\DataBuilders\BuildScriptPackedMode.cs:90)
UnityEditor.AddressableAssets.Build.DataBuilders.BuildScriptBase:BuildData(AddressablesDataBuilderInput) (at Library\PackageCache\com.unity.addressables@1.1.7\Editor\Build\DataBuilders\BuildScriptBase.cs:60)
UnityEditor.AddressableAssets.Settings.AddressableAssetSettings:BuildPlayerContentImpl() (at Library\PackageCache\com.unity.addressables@1.1.7\Editor\Settings\AddressableAssetSettings.cs:1608)
UnityEditor.AddressableAssets.Settings.AddressableAssetSettings:BuildPlayerContent() (at Library\PackageCache\com.unity.addressables@1.1.7\Editor\Settings\AddressableAssetSettings.cs:1590)
UnityEditor.AddressableAssets.GUI.AddressableAssetsSettingsGroupEditor:OnBuildPlayerData() (at Library\PackageCache\com.unity.addressables@1.1.7\Editor\GUI\AddressableAssetsSettingsGroupEditor.cs:239)
UnityEditor.GenericMenu:CatchMenu(Object, String[], Int32) (at C:\buildslave\unity\build\Editor\Mono\GUI\GenericMenu.cs:121)
ModV1 among other assemblies are used by my game to hold external code.
I created a link.xml to try to include this, not sure if it’s needed, the docs aren’t really very helpful as to when to use link.xml, why I would use it, or even how to use it or where to put it.
Anyway, if I ignore the error and run the game it does appear to load.
Here is part of link.xml at Client\Library\com.unity.addressables\StreamingAssetsCopy\aa\Windows\link.xml
Second issue:
What I’m actually loading is a custom ScriptableObject that holds a List.I can actually load it, the problem is instead of a list of 39 GameObjects, it’s a list of 39 null pointers.
Third issue: loading takes 10X longer in packed play mode vs. local! This totally defeats the point of loading asynch during loading screens since the total time is longer.
I don’t care about loading game data from remote systems, content updates, whatever. I just want to get around the 4 GB limit. How can I load resources dynamically that
- Is fast
- Doesn’t duplicate the resource (which Addressables and AssetBundles do?
- Doesn’t have a size limit (Which Resources does)?