Continuing from: Tutorial 102: Collectables and Restart
By Aaron Cheney & Peter Brinson
0. Introduction
A. Outcome
This tutorial’s outcome: Continuing from Tutorial 101 and Tutorial 102, the player collectable count is properly presented in the UI.
B. Learning Objectives
Review from Tutorial 102: Collectables and Restart
- custom events
- casting
- PlayerState
New:
- custom event parameters
- Widget Blueprint basics (Hierarchy,
TextBlock,Is Variable)- Create Widget node
- Add to Player Screen
1. Update BP_Collectable
Disconnect Destroy Actor
Return to
BP_Collectablefrom UE Tutorial 102 - Collectables and Restart. Break the connection betweenOnCollectedCollectableandDestroy Actor. In fact, you can delete theDestroy Actornode as it will be incorporated in thePlayerStateblueprint instead; destroying the collectable will be the last thing happening in the overall sequence among the blueprints.
2. Make the Score Widget Blueprint
A. Design the Widget
In the Content Browser, right-click and choose User Interface > Widget Blueprint. When prompted for a class, select User Widget. Name it
WBP_Score. Double-click to open it.In the Palette panel, find
Canvas Panel(by searching).Drag
Canvas Panelinto the Hierarchy panel. Do the same withText(under Common). From now on, we will refer to thisTextasTextBlock, per its name. Build the following Hierarchy:
Arrange
TextBlockon the canvas.Then, with
TextBlockselected, findIs Variablein the Details panel (at the very top) and check ittrue.
Hold On
Why
Is Variable? Making theTextBlocka variable provides a named reference to it in the Event Graph. Without this,TextBlockis inaccessible to blueprint script.Ask your LLM why
In Unreal’s Widget Blueprint, why do I need to check
Is Variableon aTextBlockbefore I can use it in the Event Graph? What happens if I don’t?
B. Widget Event Graph
Click Graph in the top-right corner of the Widget Blueprint editor.
Now that you’re in the graph, complete the blueprint script using these instructions and screenshot. This screenshot of the blueprint script is below the instructions.
Instructions:
- Create
OnScoreUpdated, a custom event. With it selected, add in the Inputs panel, a new parameter (of typeInteger):NewScore.- Under the VARIABLES panel, the
TextBlockwill be available asTextBlock_xxDrag it into the graph and choose Get.- Drag off the
TextBlock_xxnode and search forSet Text. There are numerousSet Text. Find the one under the category, Content.- Drag off the
OnScoreUpdatednode -NewScoreand search forTo Text (Integer)- At this moment, Unreal will insert a
To Text (Integer)conversion betweenNewScoreandSet.
Compile
Save All
3. BeginPlay Creates (Instantiates) the Score Widget
Create the Widget on BeginPlay
Return to the blueprint,
BP_InClassPlatforming_PlayerState. The following steps add blueprint script in the Event Graph you worked in during Step 3 of UE Tutorial 102 - Collectables and Restart. Add new blueprint script above or below the existing one.If it is not there, create
Event BeginPlay. Drag off ofEvent BeginPlayand typeCreate Widget. Set its Class toWBP Score.Add
Get Player Controller(Player Index 0) and connect itsReturn Valueto theOwning Playerpin ofCreate WBP Score Widget.To create the
SETnode below, right-click theReturn ValueofCreate WBP Score Widgetand find forPromote to Variable.…which also gives you - on the left - under VARIABLES, a new variable.
Name that new variable
ScoreWidgetof typeWBP Score.After the
SETnode, addAdd to Player Screen.Ask your LLM why
In the Unreal tutorial I’m following, after creating a widget with
Create Widget, the tutorial says toPromote to Variablebefore adding it to the player screen. Why do I need to store the widget in a variable?Double-check all pin connects - this is the same screenshot you saw a bit above.
Compile
Save All
4. Handle the Score
A. Add a Parameter to OnCollectedCollectable
You are still in the blueprint
BP_InClassPlatforming_PlayerState.Select on the
OnCollectedCollectablecustom event node in the Event Graph. In the Details panel, add an Input:
That Input:
Collectableof typeBP_Collectable.Notice that now the node has a
Collectableparameter pin:
(Providing a value for this Parameter comes in Step 5).
The parameter
Collectablecan pass a reference to the collectable. This is setting up the ability for this blueprint to call the collectable’s functions (potentially) as well as destroy the collectable in the level.
B. Count by Incrementing an Integer
You are still in the blueprint
BP_InClassPlatforming_PlayerState.Using what you have learned, complete the blueprint script using these instructions and screenshot. The screenshot is below the instructions.
Instructions:
- Drag from
OnCollectedCollectableand search for Add, under the category Operators.- From the VARIABLES panel, drag in
NumberOfCollectablesand connect to the Add node. (We’re doing a x=x+1, essentially).- Drag from Add and search for
OnScoreUpdated(the custom event created in Step 2B) — turn offContext Sensitive, momentarily, to find it. Connect the integer output of Add to theNewScoreparameter pin onOnScoreUpdated.- Turn
Context Sensitiveback on.- Under VARIABLES drag in
ScoreWidget(set up in Step 3) and connect toOnScoreUpdated.- Drag from
OnScoreUpdatedto createDestroy Actor.- Notice the long blue wire.
OnCollectedCollectable’s parameter -Collectable- connects toDestroy Actor. This is whyDestroy Actorwas removed fromBP_Collectablein Step 1: it belongs here, at the end of the chain among all relevant blueprints - after the number of collectables is updated and presented in the widget.
Almost there. Step 5 will remedy the runtime error you might notice.
Save All
5. Complete BP_Collectable
Pass Self to OnCollectedCollectable
Return to
BP_Collectable. TheOnCollectedCollectablecall now requires aCollectablevalue — a reference to the collectable being picked up. That reference isself.Right-click in the Event Graph and choose
Get a Reference to Self. Connect it to theCollectableinput pin ofOnCollectedCollectable.
Ask your LLM why
In the Unreal tutorial I’m following, the collectable blueprint passes
Selfas a parameter to a custom event on thePlayerState. Why does the collectable need to pass a reference to itself?Compile
Save All
What you can now build
- A score counter displayed on screen that updates in real time as the player collects items
- Any on-screen HUD element driven by gameplay events — item counts, progress indicators, status messages
- Blueprint events that carry data: not just “something happened” but “this specific thing happened, here it is”
- A multi-blueprint chain where a world event updates game state and the UI reflects it simultaneously
- The full collect-score-destroy sequence: item picked up, counter incremented, display updated, object removed
Example deviations you are ready for
- Collectables are assigned a score value through a member variable. That value is added to the on-screen score, rather than always being a +1.










Name that new variable 



