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;
}
}
}
}