How to see collected money go up?

I have a game which contains currency and instead of seeing the money go from one value to another, I want to be able to see the value go up if you know what I mean. For example, instead of seeing your money go from 0 to 250 instantly, I want to see my money increase over time until it reaches 250.

If you are reading this, I hope you understand and know how to do this and will be able to help me achieve this, thanks.

You’d need to interpolate:

Increase the TotalCoins and let the interpolate node do its magic.

I’m confused as to how to lay it out and I only have 1 variable which stores the money. Also, which blueprint does this interpolate go to?

You will still have only one variable to worry about - TotalCoins. The TempCoins displays the progress, that’s the one you want to hook up to the widget/hud.

Also, which blueprint does this
interpolate go to?

That’s up to you. Any blueprint that can Tick can handle it. You can even do it in the widget that shows the counter.

Thanks. But I have a problem, I added text to my widget and created a text binding, then I connect the money variable from a game instance to the return node. And when I go in-game, the money counter does not show.

Did you create a widget and added it to the viewport? Can you see the widget?

Yes to both of those questions.

Since binding executes every frame, just like Tick, you can simply do this:

https://gyazo.com/bc9ede6b9adc608323721d36e9e05cc1

You just need to increase the coins count:

226328-add-coins.png

Sorry for asking loads of questions but this interpolating stuff is very new to me. Which variable do you add to, temp coins or total coins, and what does your blueprint look like when you press the button?

It’s not working for me. I don’t want it set up with a button, instead, I want it to add money when the player collides with a pickup. But I debugged it with a button and the text binding did not work and making the text a variable and setting the text in the blueprint via event tick. For me, money is the total coins, and temp money is temp coins.

Sometimes its easier to google it up :stuck_out_tongue_winking_eye: There are some Videos from Mathew Wadenstein that explain the various interpolations with examples. I´m not sure what Everynone can add more for your understanding. He given you already a complete Solution. Experiment around =)

https://www.google.de/search?q=ue4+interpolation

I did google it up and did watch some of his videos. However, I don’t understand it much and he is working with cameras, whereas I am working with text in widgets.

Ah ha! Got it to work by creating new variables inside the widget and using those variables instead of the variables inside of the game instance. Thanks for the help! :slight_smile:

EDIT: Just realised that all this time, I forgot to change my game instance to the one called “VariablesAndFunctions” which stores all my variables. That’s why it hasn’t been working all this time xD So there is no need to create new variables inside the widget.

I used a button as a demonstration only.

Do note that you are now casting every frame due to the nature of UMG variable binding. This is a costly operation; while the cost is negligible in this very instance, when dealing with a 100 of inventory buttons, you’d want to avoid it and send ready data to your widgets. Or use Direct Blueprint Communication.

To avoid casting every frame and to keep the logic in the widget, Cast only once on EventConstruct and create a reference to the GameInstance in the widget (right click the VariablesAndFunctions and Promote to variable). Use the reference variable to fetch data from the GI.