This is happening in 2019.1. I haven’t tried this in a later release yet.
I have a Density Volume I’m lighting up with a spotlight set to Box shape. You can see the light here, being cast on the Density Volume, illuminating it yellow.
At runtime, I’m resizing the Size X and Size Y of the light. This properly resizes it, and if I stand way back, it lights up the wholse Density Volume:
However, if I aim the camera only at the ends of the volume, the lighting immediately turns off:
(Nevermind the dots, which are just particles)
What I think is happening is that Unity isn’t rendering the light anymore because its original AABB box (which started off with a width, height, and range all of 1) is no longer in the camera frustrum. If I aim back towards where the light’s original volume was, the light will turn back on.
Another interesting thing is that if I pause and select the Spotlight in the inspector, it fixes the issue until I exit play mode. I’m not sure what might be happening when displaying the light in the inspector, but maybe it’s reinitializing something.
Anyway, does anyone know of a way to correctly change the height/width and range of the spotlight at runtime, and refresh its bounding box so that it properly renders? I tried disabling/enabling the light, it’s HDAdditionalLightData, and calling various methods on the light to see if anything resolved it, but so far no luck. What could be happening in the inspector that’s correcting the light’s behavior?