I want to add a money system to my game. I created a blueprint which has a money variable and the functions (add, substract, and so on).
Where should this blueprint stored? And how can I create an instance of this blueprint?
I want to add a money system to my game. I created a blueprint which has a money variable and the functions (add, substract, and so on).
Where should this blueprint stored? And how can I create an instance of this blueprint?
You can put all the logic within the level blueprint, that will make it such a global thing within the level.
Or
You just drag and drop your blueprint in the level, and it doesn’t have to be rendered or so. It is just a holder for some values. But then you need to set those values to global, so it could be access from the outside.
And in order to easily find that instance and call the function, you can do it in several ways, the most easy one is “Get All Actors Of Class” which usually should return and array of actors, but at this case will return only one instance, then you can call anything within it.

Here I used it to look for the only instance in the level named “NewBlueprint”, then I can call any function or adjust any variable that “newBlueprint” have.
-m
Best result are obtained storing the variables and the functions in the game instance, so you can get values and functions in any moment and any map casting the bp using the “Get Game Instance” node. Also you can store the values in a savegame and when the game is loading transfer them from the savegame to the instance.