I have been searching and searching for an answer to this question but nobody seems to be helping me. I have wasted the past two hours trying to figure out how to do this, so please help me out here.

I am making a FPS game in Unreal Engine 4, and I want to display ammo. I can do that fine, but changing the text of the UI displaying the ammo is turning into a nightmare. I need to access the text label variable

enter image description here

Inside of the blueprint that handles the actual gun firing

enter image description here

From there I should be able to adjust the text to match what my ammo is.

Unfortunately, no matter what I try, I cannot change the variable in my blueprint. I can't even make the variable public to begin with! What do I need to do to accomplish this?

  • 1
    \$\begingroup\$ I can't really make out what's going on in that screenshot. What Blueprint type is the variable defined in (is it in the game mode, the player character, et cetera), and what Blueprint type contains the code in your second screenshot? \$\endgroup\$ – user1430 Aug 17 '16 at 16:12

Widget Blueprints can bind the Visuals to Functions. enter image description here

If you click on "Create Binding" on your Text Block, it will create a function that returns a FText Variable.

Within this function simply get your ammo from your controller/pawn/state and return it. enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.