_WorldSpaceLightPos0 value not updated by directional light rotation

I have a custom shader which is using _WorldSpaceLightPos0, however, the value of _WorldSpaceLightPos0 is not updated properly, after changing the corresponding light object rotation, _WorldSpaceLightPos0 value doesn’t change until I switch to the scene view(from game view), as soon as I view the shader render result in the scene view, _WorldSpaceLightPos0 value is changed, reflecting the previous rotation changes on the light object.

Otherwise if continue playing the game for a while, the _WorldSpaceLightPos0 will be updated from (0, 0, 0, 0) to correct value at some points, until restart unity editor.

Any idea what’s going on? Thanks in advance…

the only light source in the scene, it’s a directional light.

well… as soon as finished typing the post, another idea hit me… adding this in the shader code fixed the issue for me

so unity thought the light is used by no one… doesn’t look like a straightforward registration to me