Beating Hight Score

Hellow, i’d like to do high score blueprint which will remember last high score i had done in game. When i beat it, there will be saving new high score. Points will be adding when i destroy actor. I’ve got 5 types of actors but i want that they will be counting together at one place. I try do it at my once with help of video on YT, but it doesn’t help me. When i hit an actor, it doesnt even count. Any idea how to solve my problem? Thank You for your patient!

I don’t know how savegames work in Unreal, but I’ve noticed some problems with your setup:

  1. You currently don’t ever create a savegame because the Condition “checking” whether you load or create a savegame is currently always true. You need to connect the Does Save Game Exist return value to the condition for this to work.

  2. When actually creating a savegame, you don’t ever save it to the “Clicks” slot because the Save Game to Slot node is not connected.

  3. I’m not sure Event ActorOnClicked is ever going to fire. “Level2” sounds like you’re writing your code in the Level Blueprint but Event ActorOnClicked only fires for the object on which you clicked. You’ll probably have to move the entire Blueprint logic into your base Actor class.

Also, your code doesn’t do what you want it to do.

The Sequence node followed by the Get Actor of Class nodes doesn’t do anything except being a) very expensive (collecting all those actors) and (once everything is connected correctly) b) increasing your click value by 5 (once for each type of actor).

What you’re probably trying to do is:

  • check whether the clicked actor is of type Blue/Green/Yellow/…
  • if this is successful, increase score by 1

The good news is if you move your code into the actor Blueprint on which you can click (point 3 above), only these actors will receive the click and when clicked will increase the score. You won’t need the Sequence and pointless Get All Actors of Class nodes. (Pointless because you don’t even use the return value.)

I’ve also noticed that what happens after loading/creating the Savegame is basically identical, so you can really simplify the code:

  • Plug both Set Saver nodes’ output wire into the same Cast to Highscore node
  • Delete the other Cast to Highscore node and every node following it

Ok, i have delete what You had marked on pictures, but i don’t know what exacly i need to write in actors blueprint, can You tell me, or better show it on picture?

Do your color actors have a shared parent class (other than Actor)? If yes, you can move your entire logic (that you posted here, minus the unneeded ones you deleted) into that class.

Otherwise, your best bet is to create such a parent class. I or someone else can tell you how to do that, but for that we need to know what your color actors currently have as a parent. When hovering the mouse over your actor class in the Content Browser, what does the tooltip show as “Parent Class”?

there are actors parent class. So i can’t get it into their blueprint?

First, I’d really recommend reparenting your color actors because that has several advantages. (For example, if you want to check if a hit actor is one of your color actors, but don’t care which color, you could check whether it’s of the parent actor’s type because they all have the same parent. Or to check whether there are any color actors left in the game, you could call Get All Actors of Class for the parent actor.)

Here’s how you can reparent your actors:

  1. create a copy of your entire project directory!
    (as a backup just in case something goes wrong)
  2. Create new Blueprint class → pick Actor as parent class
  3. Name it something that makes clear that it’s the new parent actor (something like BaseColor or ColorParent or whatever)
  4. Save and compile the new class
  5. Open one of your color actors’ Blueprint
  6. Click on File > Reparent Blueprint


  1. Select your new actor in the menu
  2. Compile and save the actor
  3. Repeat steps 4-8 for all your other actors

Test your project. If everything went well, the game works just as it did before and you’ll have no new errors or warnings.

Next, you want to be able to call your saving/loading code currently in the Level Blueprint. In 4.8 it’s not possible to access the Level Blueprint directly, so we need to work around this by using a dispatcher.

In your new parent actor, add a new Event Dispatcher, give it a name, and compile the Blueprint. Then add the ActorOnClicked event and call the dispatcher you just created. Again, save and compile.

Open your Level Blueprint. Replace the current ActorOnClicked event with a new custom event. On BeginPlay, loop over all actors of the new parent class (this will collect all color actors!) and call Bind Event to (your new event dispatcher). Connect the red boxes of the Bind Event node and the custom event you created earlier. Save and compile.

Here are some tutorials on Event Dispatchers:

What happens here is that the Level Blueprint registers to the dispatcher, so any time the dispatcher is called, the Level Blueprint will hear the call and react to it. Now, whenever you click on one of your actors, the actor will call the dispatcher, which will inform the Level Blueprint to increase the score.

At least in theory. There are probably still some problems but I’m sure we can get this to work. :slight_smile:

ok i do all as you say in first comment, but now when i reparent actors, no one spawn in my game :confused:
i fix it, actors spawn, but they cant be destroyed in game. i try to do that, but if i cant, i will write :slight_smile:

When and where i need to create a custom event called IncreaseScore? I dont have it for now

You can call it whatever you want. It’s just something to replace the OnActorClicked event in the Level Blueprint.

and this blueprint which is saing my highscore i must put into new actor blueprint? And delete from level blueprint?

Ah no, sorry. I’ll try to explain better.

In your the Level Blueprint (Level2, first screenshot):

  • replace ActorOnClicked with a BeginPlay event.
    (If you already use BeginPlay in your EventGraph, just connect the Get Actor of Class node after the current BeginPlay logic.)
  • link the Increase Score event to the Does Savegame Exist node.
    (You can remove the Print String node, that was just for testing.)

In ColorBP (new parent actor, second screenshot):

  • remove the connection between Call Dispatcher1 and Does Save Game Exist.

I hope that’s clearer now. :slight_smile:

ok i do it as you say, but it do nothing in the game, actors are spawning i can destroy them, but i still haven’t got any counting, and saving highscore. What is wrong?

I think the dispatcher isn’t working correctly, because when hit an actor nothing is wrinting in game, even is there a print string with some words.
But all color actors are now in dispatcher parent class, and i don’t know why it is still doesn’t work.

I tested the dispatcher in a test project and I got my testing message (Print node in the Level Blueprint) printed when I clicked on my test actor (child actor of the one containing the Dispatcher). So it really should work…

Do your child Color Actors’ Blueprints also contain an ActorOnClicked event? If yes, you need to remove it (or at least the first wire).

In ColorBP, if you place a Print String node between the ActorOnClicked event and the Call Dispatcher node, does that message get printed?

i’ve got another idea how to do it work i want. In this idea i need to compare two dynamic materials, and for that reason i make another question in which one you try to help me :slight_smile: and i make it that way:

  • in game are spawning random actors with one of 5 colors. It’s one actor now, not 5 like it was before.
  • Now i need to compare these dynamic metarials.
  • When it will work i start to making a HighScore system, but with one actor clicking, not five, so Dispatchers are not needed now.
  • But I still don’t know how i can do this simple HighScore, which will remember my highest score, and when i will beat it, the new one is saving.
    Can you help me with this things? Thank you very much for previous aid, it really helped me a lot and a lot to me:)

Sorry for my bad english