Search code examples
unity-game-engineurp

How to set environment ambient intensity when two scenes are loaded additively in Unity?


I have two scene loaded additively. In each scene, there is an Environment Lighting Intensity Multiplier value.

enter image description here

I have found how to set this value in code, which is RenderSettings.ambientIntensity. But it seems that only the first scene's ambient intensity is set when setting this variable.

Which ambient intensity is used when two scenes are loaded addtively? And how do I make sure the Environment Lighting Intensity Multiplier is set to the value I want in this situation? Thank you.

I am using URP and Unity2022.1.0f1.


Solution

  • I suppose, your script that sets the Intensity Multiplier is only on the first scene. You can copy it in the second scene and it should work.

    https://docs.unity3d.com/ScriptReference/RenderSettings.html

    RenderSettings affects only your active scene.