#HDRP - Set Light Intensity defaults to candela

1 messages · Page 1 of 1 (latest)

deep owl
#

Hi guys,

this seems to a pretty easy task, but somehow I do not get it run like I would like to.
See take a look on the image.

I would like to set the light intensity on start. It kind of works, but in the wrong way.
The lights defualt, set in the inspector, is set to lumen and a value of 600.

When reading the value, I get Lumen and a value of 2802. The light unit is correct, but the actual value is candela.
When setting the value, I set the actual value of candela, not lumen. What am I doing wrong here?

void Start()
    {
        SetIntensity();
    }
    private void SetIntensity()
    {
        
        var lightComponent = GetComponent<Light>();
        Debug.Log($"Default - Light Unit: {lightComponent.lightUnit}");
        Debug.Log($"Default - Light Intensity: {lightComponent.intensity}");
        lightComponent.lightUnit = LightUnit.Lumen; //To be sure ~
        lightComponent.intensity = 10000.0f;
        Debug.Log($"Adjusted - Light Unit: {lightComponent.lightUnit}");
        Debug.Log($"Adjusted - Light Intensity: {lightComponent.intensity}");
    }