How to pass a value into BasePassPixelShader.usf?

I want to set up the Editor so that I can put a new variable in the World Settings window, and then apply whatever values the user sets there in BasePassPixelShader.usf.

So far I have set up the value in the World Settings window by declaring it in WorldSettings.h and setting a default value for it in WorldSettings.cpp.

I have added the variable to the FViewInfo object named View by adding the variable in SceneView.h using VIEW_UNIFORM_BUFFER_MEMBER(FVector, MyVariable).

I am able to access the variable from within BasePassPixelShader.usf as View.MyVariable.

So far, so good. What I am having trouble with is this: When I change the value in the UI, in the World Settings window, nothing happens. I understand that there is a connection missing between the UI and the View object. I guess I need a callback that updates the value in the View object with the new value from the UI? Or maybe somewhere I need to refresh the MyVariable value from within the View object. Any help appreciated.

If I’m going about this the wrong way I’m open to hearing that too!