Baking Addressable Lightmaps before Build

Hey there! So at my job we use jenkins to do automatic builds. Currently we are setting up a new project that relies heavily on addressables. Basically we have a core application that can then be extended with different modules, which are loaded in as addressables. These modules contain environments that need lightmap baking. So the issue is that we want to automatically trigger a lightmap build on the addressables before building the app itself, so that all the addressables are properly set up in the final build.

My last attempt was to have a method like this, which is called in the Jenkinsfile to trigger the build.

public static void BuildWithAddressableLightmaps()
{
    LightmapBakingScript.BatchBakeLightmaps();
    JenkinsBuilder.PerformWindowsBuild();
}

The LightmapBakingScript just calls a lightmap bake on every scene we need. PerformWindowsBuild is from a company package and basically just ends up building using the Unity BuildPipeline.

What ends up happening is that in the build the addressables are completely broken and the scenes wont load at all. Without the lightmap bake it builds just fine.

Would really appreciate if anyone has an idea! Thanks!

Hey. Need some more info to troubleshoot here.

If you try only running the baking portion, do your scenes look correct before build?

If you manually bake the scenes, save them, and then run the build in isolation, do you hit the same issues?

You say the addressables are broken and the scene won’t load. What kind of errors do you get? (Check the log).

Regardless of the answers to these questions, I suggest filing a bug report if this is blocking you.