I have a game where you are given options In a widget by clicking on buttons that take you to the next scenario. How can I make it so every button has a coded value and it adds them all up at then end so on final screen it will read. A certain score the player achieved. I have been trying for a few weeks to figure it out
I’m not sure if this is what you want, but here you go
In UE4 every actor related to the current world instance, goes down with it when that world is destroyed and in next one new actors are created. Every time you change a level world is destroyed and new one is created with new level. GameMode and PlayerControllers are also actors (What classify as a actor in UE4 is a attachment to a world alone, not physicality), which means when world instance is destroyed they all getting cleared and reset.
There diffrent class which is persistent in entire game and it can be used to contain persistant between level data. It’s called GameInstance, it’s like GameMode just persistent. Here you have docs about it:
It also avable in blueprints, just create blueprint of GameInstance class, set game instance class in Project Settings. Then you can access it anywhere from this node (ofcorse you will need to cast it to your class to access stuff from it):
Like My game is entirely built using Widgets. So once you go from level 1 to level 2 widget I want it to add the score to a final score. So say you click option 2 on level 3 that will give a value of 30$ but option 1 would give you 10$ How would I make it save the score and make each button contain that score value