iam trying to create a tiny buisness simulation only with UMG.
for example : from the main menu u click the button “market” and get to a new widget where u can “buy wood” .
my first question is what is the best way to store all that variables (stockpile for every ressource, cost for every ressource, playermoney etc)?
my second question is: when i press the “buy wood” button in the widget “market” how do i reduce the wood stockpile ressource by one when the variable is not in the widget?
cast to gamemode -> set variable cant be the way this works, can it?
i hope someone can understand what i mean and is able to help me out
greetings
VoodooDog
Inside of your own, custom “GameState”, you will want to create variables for your store. So for example a variable “Money”. And/or you create
a struct with “Resource Name” and “stockpile” as variables and create an array of this struct for your store.
And then you can easily, on a button press in UMG, get the GameState and change the variables.
And also get them and display them.
BIGGEST THING TO REMEMBER: Don’t put logic into UMG. Only let the Button presses call functions IN the GameState. Don’t store stuff in a Widget.