Lightmapping not showing when changing scenes

My application has two scenes, the first is basically a splash page and the second has the main 3D content of the scene. In the second scene, I’m using lightmaps to improve performance.

When I load the second scene from the first, the lightmapping seems to be ignored unless I force it to bake somewhere in my code. If I run the scene directly (launch from editor), it works fine.

I’ve tried using loadSceneSettings with loadSceneHierarchy, but I only get an error (‘could not subscribe’) in console.

So I guess, two questions:

  1. How do I load a scene with lightmapping applied, from another scene?
  2. How do I use loadSceneSettings correctly?

For reference, I’ve created a simplified version of the project here - https://playcanvas.com/editor/scene/504112
Mouse click to change scenes, then click again to manually bake lightmaps.

1 Like

Lightmap baking is applied automatically after preloading on first render. But never is executed again automatically as it is case specific.

So yes, if you load new scene and need to apply baking, you have to do it manually.

But generally, I would avoid multi-scene workflow altogether. As it just complicates everything without real benefits.

1 Like

But generally, I would avoid multi-scene workflow altogether

I know what you mean :slight_smile: It’s been an uphill battle trying to use multiple scenes in any meaningful way. The problem seems to be that scenes aren’t sandboxed within the context of the page, so you need to manage anything that influences the page from a previous scene.
Specifically, I’ve noticed you need to:

  • Manually remove old events (for example mouse or touch events)
  • Remove any HTML and CSS (for example from UI elements)

For those who (like me) come from a Unity background, loadSceneHierarchy seems to work more like loading scenes additively than completely replacing the scene.

Regarding loadSceneSettings, why am I getting an error?