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.
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.
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 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 =)
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!
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.
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.