Chests/Lights UI not working

I have created an end game widget blueprint, but it does not show the correct number. Instead of showing that I opened 1 chest/light, it shows that I’ve opened 30 which I don’t have 30 chests/lights in my level. Is there a way to fix this? Here is a screenshot of my blueprint. I created a function that adds how many chests/lights are in my level by 1 when the player opens the chest or turns on the light. And I put it into the return node after a boolean is called to determine if the light has been switched or the chest has been opened.

Here is a display of the endgame numbers
Unreal EndGameDisplay

Hey! For something like this, you want to store these statistics in variables. To keep it simple for this explanation, lets say you store them on your character blueprint:

Next, I’ve made a simple coin pickup actor:

In your pickup actor, you can then do something like this to write to the variable that we’ve created in the character blueprint:

This will add one to our “CoinsCollected” variable and destroy the pickup actor when the player overlaps with the collider.

Now the UI part. I have created a simple statistics UI like this:

Select the text which will be displaying the amount of coins you have, and on the Details panel, under Content, create a new Binding:

Inside your widget, create a new integer variable - “CollectedCoinsTracker” - make sure it is instance editable and exposed on spawn:

Hook that variable up to the return value on the text binding we’ve created:

Now, to display the widget, I will use the character blueprint:

Please note that there are many ways of doing this, and this is something I’ve whipped up really quick to help you understand a bit better. This code certainly could be improved, but I hope it helps!