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!
Answer by Hellium · Sep 07, 2017 at 04:03 PM
I think you are looking for RenderSettings.ambientIntensity
(don't mind the word "ambient")
https://docs.unity3d.com/ScriptReference/RenderSettings-ambientIntensity.html
Answer by jmarcos007 · Jan 07, 2021 at 11:17 PM
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
}
}
Answer by dabitnk10 · Feb 20, 2021 at 04:41 PM
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.
Your answer
![](https://koobas.hobune.stream/wayback/20220612134359im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
I can't get my scene to darken 0 Answers
Why do i still see the light shine on my object? 0 Answers
Can't enable Unity Ray Tracing 0 Answers