Getting a Counter for each click of an object

I have a sphere(in-game), and I would like to make it so that each time you click it, it adds 1 to a counter that would display on screen at the top.

I have this: Screenshot - 13baeba576dfffa029dfd1b44b555ef6 - Gyazo

I have the counter display but when I click it it wont change. Maybe I am completely wrong.

Thanks for the help in advance.

Hello Chaserchim,
Your issue may be connected to how you are selecting your object, In your current blueprint you are calling for the event to fire when you click the actor, but to get the desired result you will need to have it be when you click the specific component. Another note, the way you are passing your integer will add an additional +1, if you are looking to just increment a value, there is a node that specifically increments by a value of 1!

Perhaps I am missing something. I cant seem to find the OnClicked event.

Ah. I found it but my variable isnt in the same blueprint. How would I get it into the same blueprint?

You could do a couple of things, in my example above, I made the variable inside of the actor and had it increment there; however, If you wanted the value to update on a widget I would do the following:

  1. Create your variable inside of your game state and create your widget there (Screenshot_01)
  2. Your widget should have a variable that is bound to your text (Screenshot_02)
  3. Now we simply cast to the game state upon click the sphere and update the values (Screenshot_03)

Hope this helps!

This seems to be happening, No clue what this means.

Based on the picture you linked, I have a couple of suggestions:

  1. Your “Counters” is either not the current Game State or is not a game state (You can set your Game State in the project setting under Maps & Modes)

  2. For your Casting, you only need to cast once, Incrementing the value automatically sets it, so You do not need the second cast.

  3. Your Touch event does not look like it is bound to a specific object or actor (to do this simple select the component in the component tab and then right click and use the add event category)

Hope this helps!