Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Change Directional Light "Intensity Multiplier"

Discussion in 'High Definition Render Pipeline' started by jmarcos007, Jan 7, 2021.

  1. jmarcos007

    jmarcos007

    Joined:
    Mar 2, 2017
    Posts:
    11
    Hi there! I have a Directional Light in my scene. It's possible change de "Intensity Multiplier" through script?
    I've look inside th forum and I found this code below but is not working:

    RenderSettings.ambientIntensity = 16;

    But I can change another settings like "Intentensity" using:
    DirectionalLight.GetComponent<Light>().intensity = 10;

    I´m using HDRP and Unity 2019.4.1f1. Someone can help? Tks
     
  2. jmarcos007

    jmarcos007

    Joined:
    Mar 2, 2017
    Posts:
    11
    Ok I found the solution.
    This code can change de "Intensity Multiplier" for a directional light in HDRP.
    I attach this script to my 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
    }
    }
     
    ullisbullis likes this.