I have a build script that I use in conjunction with Jenkins build server which uses a Build Script that calls BuildPipeline.BuildPlayer(…) to trigger builds. I’m noticing that the Addressables system doesn’t build any asset bundles when making a build in this way.
If I use the standard Build settings window and do builds that way, then the asset bundles do get built.
Is this a missing feature still to come, or do I need to use another API call to trigger the builds?
The script above works for me, except that sprites contained in SpriteAtlases don’t work for me when I build from script rather than from the menu. Is there a way of seeing the exact steps unity is taking when we click “Build”?
To reproduce from an empty project simply create a prefab with a Sprite Renderer component that contains a reference to a sprite that is contained in a Sprite Atlas.
Now add this prefab to an addressable group and instantiate it from a script.
When you build the game for WebGL from batch mode using the script above the sprite atlas won’t be built into the addressables correctly and the sprite won’t load in game.
In the next release, you can call AddressableAssetSettingsDefaultObject.Settings.BuildPlayerContent(). This will use the build target and group and the development flag from EditorUserBuildSettings. I will look into why there may be issues with Sprites. Also, the automatic building of bundles when a player is built (or entering play mode) has been removed. We determined that it makes more sense to have that as a separate step since it can take a long time. In the editor play mode, Fast & Virtual build scripts will still do some processing but the PackMode will rely on already built bundles.
I’m trying to get this working now with TeamCity. Just like arvzg, if I build from the editor, everything works. As soon as I use BuildPipeline.BuildPlayer nothing works.
I have tried to manually get it to build addressables before I build the player and am able to get it to populate the StreamingAssets folder, but I must still be missing something.
Any ideas?
EDIT: I have tried using the same script I am using for Android with StandaloneWindows64 as the target and it actually works. I’m not sure what I’m doing wrong