How to set Intensity Multiplier via Code

Hey folks,

who knows where to set the “intensity muliplier” of the environment lighting per code. I can access it through the lighting window, but how I can change it in script.

Thanks!

101440-ex.png

Hi! Use this:

RenderSettings.ambientIntensity = 0.5f;

You can put the value you want (with an F at the end if it is decimal, to tell Unity that it is FLOAT).

This line, you can place it in “void Start ()” or wherever you want.

I think you are looking for RenderSettings.ambientIntensity (don’t mind the word “ambient”)

This code can change de “Intensity Multiplier” for a directional light in HDRP.
Attach this script to the Directional Light gameobject.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering.HighDefinition;

public class ChangeIntensityMultiplier : MonoBehaviour
{
     void Start()
     {
          var light = gameObject.GetComponent<HDAdditionalLightData>();
          light.lightDimmer = 5; //set here desired value
     }
}