Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

HDRP 4.10 - Setting light intensity not working

Discussion in 'Graphics Experimental Previews' started by JacketPotatoeFan, Mar 11, 2019.

  1. JacketPotatoeFan

    JacketPotatoeFan

    Joined:
    Nov 23, 2016
    Posts:
    34
    Hi,

    Am simply trying to set a point light intensity in the Start method, but nothing changes.

    I created a default HDRP (am using 4.10) project using the template.

    The color in the Start method gets applied, but no intensity. But pressing a key (see Update method) does update the intensity.

    I want to set a light intensity outside the Update loop. Am I missing something here?

    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. public class Test : MonoBehaviour {
    4.  
    5.     public Light l;
    6.  
    7.     void Start(){
    8.         l.intensity = 1500f;
    9.         l.color = Color.blue;
    10.     }
    11.  
    12.     void Update(){
    13.         if(Input.GetKeyUp(KeyCode.L)){
    14.             Debug.Log(l.intensity);
    15.             l.intensity = 1500f;
    16.         }
    17.     }
    18.  
    19. }
     
  2. OutFoxeed

    OutFoxeed

    Joined:
    Jan 1, 2020
    Posts:
    1
    Replying to this very old question in case someone like me encounters this problem with HDRP lights.

    I found out that the component named HDAdditionalLightData which is always beside the Light component has some values including "intensity" and this one seems to work the same as the Light.intensity but works in the Start.

    I'm currently replacing all Light variables to HDAdditionalLightData vars in my project :/