Resetting values of controls without parameters

I have some controls which aren’t attached to parameters but which I’d like to return to their default states when the user hits my plugin’s Reset button. I’ve currently implemented this with the following line:


However, the proper execution of this line hinges upon GetUI() not returning nullptr. I do have a conditional statement to check that the UI pointer is not null, and it’s probably impossible anyway for the reset function (which is triggered by user input) to execute without the UI being visible, but for other use-cases, I was hoping that there’s some function that would allow me to set a control’s value regardless of whether the UI is visible or not, or at least put the request to change the value in a queue, to be executed once the UI is displayed. Is there a better way to go about this? Thanks!

Any state that needs to be maintained whether the UI is open or not can be stored in a member variable in your plug-in class. Then you can initialise your controls based on those variables in the gui layout (lambda) function. Alternatively you can override IEditorDelegate::OnUIOpen() and set the controls to the correct state there.

Ah, of course - that makes a lot more sense. The control in question is already set up to affect a member variable of the plugin class, but for some I reason I was going about things backwards and was planning to set the variable back to its default via the control.