Download

how do we add an ammo counter to a VR game?

most of the directions online are for 1st or 3rd person games. and they say go into the input action and edit from there. but I dont see a input action for shooting a gun, is t his something I should edit in the gun base, or the VR character? I just need to know where to inject the code. thanks

Which button are you using to shoot? You must have an action input in order to be able to shoot, check Project Settings -> Input -> Action Mappings to find on which input action is your shooting button bound to.
Unless you’re just calling and event in your BP/C++ based on button pressed, without binding it to an action input.

In both of those cases, your VR Character should have a variable that represents current ammunition. At the very start of shooting event you should add branch/if statement to check if you have more than 0 ammo, if you do then enable shooting, if not block it.

yeah my VR character doesnt have all that neither does my input actions, the only thing that has the fire action is the gunbase blueprint. is this were the code should go?

I was able to do my first edit of code that worked!

Im using the VR expansion plugin and I had to edit it in the GUNBASE blueprint.

but now how do I get the text value to show up on the gun widget?

most directions are for 1st person games and they always just cast to 1st person character/viewport to see the ammo

I dont need it on the screen and need it on my gun, do you know which code I use since its a VR game and cast to first person wont work:?

the second picture is from a youtube tutorial showing how its dont but there are no tuts for the vr