Baked lightmaps are not loaded in a dinamically added scene.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By lsgrandchamp

Hello,

I have a game where the map is loaded and then added to the three dynamically. The map does have a baked lightmap, which is working normally while in the Editor, but not when playing.

The game’s remote tree, the error shown with its “origin”, and the remote baked lightmap properties:

When the map is loaded, a bunch of the same errors appears in the Debugger:

E 0:00:10.460   instance_set_use_lightmap: Condition "lightmap_instance->base_type != VisualServer::INSTANCE_LIGHTMAP_CAPTURE" is true.
  <C++ Source>  servers/visual/visual_server_scene.cpp:838 @ instance_set_use_lightmap()
  <Stack Trace> Game.gd:48 @ begin_match()
                Game.gd:27 @ peer_map_loaded()
                Game.gd:45 @ _map_loaded()

PS: When I click on the error, it goes to the add_child method which adds the loaded map to the tree. If I play the map directly with the “Play Scene” button, the baked lightmaps are loaded normally.

The game plays normally, with the exception being that it is not using the baked lightmaps. I’ve never faced this error and there is no information regarding it on Google. Do you know what may be the cause?

Regards,
Lucas Sene

Does this occur if you bake the lightmap with Capture disabled in the BakedLightmap properties?

Either way, I’d recommend opening an issue with a minimal reproduction project attached.

Calinou | 2022-03-24 16:36

Hey Hugo,
This happens also when baking with Capture disabled. I’ve made some changes to the scene, and I saw that the number of errors is equal to the number of meshes used in the baked lights.
I tried to reproduce this error with a simple scene, but it worked normally.

lsgrandchamp | 2022-03-25 01:25

Hey,
I’ve managed to reproduce the error. The problem seems to happen when I load the backed scene using a thread.
I’ll open an issue, thanks!

lsgrandchamp | 2022-03-27 00:20