create your widget from gamemode and then put in a variable inside gamemode like
myUiWidget
then from your actor you can access gamemode and then your widget. No need to cast it.
gamemode:
actor: