Scoring not adding up


I have set up a point and click world, when the player presses on the actor it collects the score and then removes the actor from the world.
As I wasnt sure where to place the score as I am not using a character I placed it within the actors blueprints. However Instead of the score adding 1 everytime I click a new actor it just prints 1,1…
What am I doing wrong?


Is that score variable keept in each actor? I bet it is.

You see variables are local to actors. So if you have 2 blueprints (lets call them BP_Score) in level. And both blueprints have “score” variable. That variable will be local to each blueprint. This is basic thing with object oriented programming, each actor is separate object sand has its own copy of variables.

To make “Score” variable working you need some global score variable. Good place for keeping score would be player controller (or player state).

For it all to work you need to setup game mode, pawn controller and all that. Then add “Score” variable to player controller. Then from clicked blueprint find player controller, cast to your subclass of it and update score variable.

And watch tutorials that can be found with: “unreal blueprint communication”.

I have set up Pawn Controller. So I create the variable score in Player controller and then I dont quite understand what I am meant to be doing. Not sure where to connect player controller.

And watch tutorials that can be found with: “unreal blueprint communication”.