Have I encountered a Unity bug or am I misunderstanding something?

Hi there. I am an intermediate developer, so maybe I am just misunderstanding something. Please make me smarter. I encountered this not so many moons ago:

I have a world that is comprised of several scenes that are loaded additively. I have 1 directional light that provides real time shadows. However, each of the additionally loaded scenes also have their own directional light used for baking. The mode is thus set to ‘baked’. I expect these lights to not contribute with anything when the game is running. However, this is not the case.
I found that some of the ‘baked’ directional lights still contribute to the overall illumination of the entire world, but not all. That’s interesting.
Upon further investigation, I found it was only the scenes that had not yet been baked (hence, no lightmap available), whose directional light would illuminate the entire world. I could confirm this by deactivating those specific lights at runtime, and the extra light would disappear. I am a 100 % certain that these lights were set to ‘baked’.

I further confirmed my suspicion by finishing the baking of the remaining scenes, and indeed the extra light disappeared and the problem was solved. But this got me thinking, as this is obviously not the expected behavior? Did I encounter a bug or is this intended?

Regardless, for my project it does not matter much. The issue was resolved, and ultimately I could just turn off the bad behaving directional lights if it was necessary. I am simply just curious as to what is going on.

Thank you.

If I’m reading your post correctly, this is actually intended behavior.

A baked light will act as a realtime until the scene has been baked. IIRC the intention was to make it easier to author the scene. We found that users were confused when they put a light with mode=baked into the scene, but see no lighting whatsoever in the scene view until the scene is baked.

This is implemented via a hidden flag on the light component. It’s actually possible to view (and modify it) if you use the debug inspector:

image

That “is baked” field is false before bake and true after bake.

It can also be modified via script Unity - Scripting API: Light.bakingOutput.

Thank you so much for the reply. That explains it all :slight_smile:

I don’t know if I agree that’s it’s a better user experience (at least not for me), as it was more confusing than anything to figure out what was going on.

Regardless, thank you for quickly elaborating!