

I think we should add some code to unity-builder that automatically checks users' lighting settings+lightmaps, but I also think we need to have a way for users to opt out of that check.What does it mean when your lighting gets “baked” into a lightmap? How does direct light differ from indirect lighting? Why is your moving object’s shadow not being casted by your baked area light? In this blog I will go over the basics of lighting in Unity 2020 to give you a head start into the wonderful world of lighting so you can build prettier (or uglier if that’s what you are going for) games.
Unity ambient light update#
How would we check every material in every scene for lit shaders?Įven if we are able determine if any scene has materials with lit shaders but no lightmaps, how would we know if the user actually even wants to bake in those lights?įor example, what if they have a scene that would require lighting, but they know they're going to change the offending material/shader at runtime, so they intentionally don't bake in the lights?Īlso, it's generally considered a bad practice to include lightmaps in git, but what if a user does? We could assume that their lightmaps are correct and therefore skip generating new lightmaps, but I feel like we should actually watch out for users and suggest they update their. If we want to generate lighting in CI, we can call lightmapping.bake : And in my project, I would set checkLighting to false. Maybe we could have additional option like checkLighting, which may be true by default, and if so, that would trigger the test of opening each scene file to see if lighting can be generated. I wouldn't want to add these files to my repo I wouldn't want to set allowDirty to true and I obviously wouldn't want my build to fail just because some useless lighting files are not in my project. For example, my project is entirely unlit 2D, but it is still possible to generate useless lighting files. Or they could choose to set allowDirty to true.ĮDIT: I thought about it some more, and automatically trying to generate lighting files for each scene is a bad idea, even with the above.

Idk if it currently works this way, but if a build fails because allowDirty is false, we should clearly list out which files are new or modified, which should allow the user to fix it from their end.

If any lighting files are generated, the build would fail if allowDirty isn't set to true. I think the simple solution may be to use the Unity Editor to open each scene in the build settings. That is, change the Environment Lighting Source to Color and select an appropriate color. Using a solid-color ambient lighting seems to work fine. I tested to see if this occurs with a non-default skybox, and verified it does still occur in that case. Under Environment Lighting header, select Source drop-down.The relevant settings are found in the Unity editor under: The three opposite sides will be dimly lit because they are only lit by environment/ambient light. 3 sides will be brighter because they face the default directional light. You should see all sides of the cube are illuminated. Build the project using GameCI and observe that 3 sides of the cube are black (unlit).

Add a behavior to rotate the camera to be able to see all sides of the cube.Select the default SampleScene for the build.Create a new Unity project using 3D template.Surfaces lit exclusively by the skybox will appear black. Environment / Ambient Lighting from the Skybox is missing.
