Scorekeeper BP:
You can create an Event Dispatcher
in your Score Keeping Blueprint.
Scorekeeper BP:
When your scorekeeper decides the game is over, it can call the EventDispatcher
.
Character BP:
Which will trigger any events that other actors have subscribed to that dispatcher. In your character’s bp’s you’ll want to subscribe to the scorekeeper’s event dispatcher like this…
If you need to find a reference to your scorekeeper, and only have one in your game, you can to the following…
Character BP:
- [Get All Actors Of Class][4]
- Then take the first value in the [Array][5], Use the
Get
node and use an index of0
. - The value you get from the array, is your ScoreKeeper, but your BP doesn’t know that, so you need to then cast the value to ScoreKeeper.
- Then save it in a variable that you can use to drag pins off of.
Another way, would be to store the reference in your GameMode, or have your GameMode keep the score.