Cannot change shadow resolution in runtime URP

I noticed I cannot change shadow resolution in runtime by script in URP, 6000.0.25f1~28f1.
The issue had reported here for HDRP but the situation seems to be the same for URP as well.
Here is a simple sample code I use for checking. Let me know if someone knows this is a bug or I miss something.

using UnityEngine;

public class ShadowResolution : MonoBehaviour
{
    public enum SHAOW_RESOLUTION
    {
        Low,
        Middle,
        High
    }
    
    public SHAOW_RESOLUTION resolution;
    Light light;
    // Start is called once before the first execution of Update after the MonoBehaviour is created
    void Start()
    {
        light = GetComponent<Light>();
    }

    // Update is called once per frame
    void Update()
    {
        if(Input.GetKeyDown(KeyCode.Space))
        {
            switch (resolution)
            {
                case SHAOW_RESOLUTION.Low:
                    resolution = SHAOW_RESOLUTION.Middle;
                    light.shadowResolution = UnityEngine.Rendering.LightShadowResolution.Medium;
                    break;
                case SHAOW_RESOLUTION.Middle:
                    resolution = SHAOW_RESOLUTION.High;
                    light.shadowResolution = UnityEngine.Rendering.LightShadowResolution.High;
                    break;
                case SHAOW_RESOLUTION.High:
                    resolution = SHAOW_RESOLUTION.Low;
                    light.shadowResolution = UnityEngine.Rendering.LightShadowResolution.Low;
                    break;
            }
        }        
    }
}

actually, I had the same issue and posted it and no one answered, but I found out that you have to get the HDLightData script and change the shadow resolution from there.

HDAdditionalLightData hdLightData = Sun.GetComponent();
hdLightData.SetShadowResolutionLevel(0);

1 Like

Thank you for the reply.
Unfortunately, it seems UniversalAdditionalLightData has additionalLightsShadowResolutionTier property but it only has getter and I cannot find the way to set shadow resolution.
Do you have any suggestion?

in URP, at least in Unity 6000.27 that I am testing right now, you only have the resolution for soft shadow so you can change the quality for that, also remember that the structure of HDRP and URP are completely different, in URP you can change most of the quality sections in URP Assets. The URP lighting is not that much heavy. the right way is to get the URP assets and change the settings from there.

universalAdditionalLightData.softShadowQuality = SoftShadowQuality.High;

the right way is to get the URP assets and change the settings from there.
Yeah, but I need to adjust the shadow resolution at runtime to optimize the visual quality as much as possible.

This is easily achievable with BIRP. However, URP is now on version 17, and I am genuinely shocked that it still lacks such a basic feature.