Cast Variable to UI in VR

So I made a user interface in a first person character template and it works fine, In the First person character BP there is a function (Decrament) that decreases the value of my variable oxygen, I then cast the variable oxygen to my UI and progress bar using this code.

Now I would like to implement the same code but in a VR template. I am using the Motion controller pawn to create my Widget UI on. I have the same function (Decrament) but now in my Motioncontrollerpawn BP. I now want to cast the variable oxygen to my progress bar in my new UI in VR. However I dont know what to replace the box “Get player character” with so the code will compile and work.

If anything is unclear just ask and I will explain as best as I can.
Any help would be greatly appreciated. Thanks.

I’m not sure I understand where exactly your two code snippets are - inside the pawn character BPs? Because if so, you should be able to use the same GetPlayerCharacter function.

Anyway, in VR you usually have a 3D-widget. What I usually do is that I save a reference to the widget’s “owner” (the player) when creating it, so I can easily access the correct player. I’m not sure if this helps you at all, but Here is a snippet from one of my menu widgets, and one from my pawn character, where a button press “spawns” the 3D widget.

First, in the pawn character, when pressing a button, I spawn the 3D-widget. In there I access the HUD, and call a function “set owner”, which I pass a reference of the player.

Then in the Widget Blueprint, I can cast to my pawn character as shown.

I hope this can help you some. Unfortunately it’s not as easy to get help for VR related questions as it is for standard games.