How to differentiate Addressables build from entering playmode in IProcessSceneWithReport

IProcessSceneWithReport invokes the following callback when building the player, building Addressable Groups or entering playmode: void OnProcessScene(Scene scene, BuildReport report) When entering playmode or building Addressables, the BuildReport argument is null. This way I can differentiate between entering playmode or building a player. However, now since Addressables are used in my project, I need to know when Addressable scenes are being processed during the bundle build, but not during enter playmode. Any ideas how to do this?

I’m stripping GameObjects from scenes during the build. Previously (before using Addressables), this was very easy with this callback and simply checking the BuildReport argument. I want my GameObject to be removed when it’s a real build, but I need them to stay during play mode in the editor.

In the meantime, I’ve used the following approach: Application.isPlaying returns true when the callback is invoked during play mode and false if it’s a player build or Addressables build. The BuildReport is not available in Addressables, but in my case I only needed to check if the build is a development build for now, which can also be done via Debug.isDebugBuild.

Well one idea that comes to mind is extending BuildScriptPackedMode and setting some static variable to true during build. Then you can check this variable from anywhere to see if you’re currently building in a packed mode.

1 Like