Last lesson we created our first collectable – we could walk up to it and pick it up, but other than disappearing it didn’t do anything. In this lesson, we will begin counting the collectables we pick-up.

When creating our collectable we created a new blueprint. This time we are going to alter an existing blueprint – our Game Mode blueprint. In the Content Drawer search and select “BP_ThirdPersonGameMode”.


On the left side in the Variables panel, use the plus button to add a variable named “[items]PickedUp”. I called mine KeysPickedUp. Change this variable from a Boolean to an Integer. This will make the variable track whole numbers.

Right-click a blank space in the Event Graph. Type and select “Add Custom Event”. Name this event “[Item]PickUp”. Remember this name as you will need to use it later.

From the Variables menu on the left drag your Interger into the Event Graph and select “Get [Items]PickedUp”.

In the Event Graph, drag from the green arrow of the “[Items] Picked Up” variable and release. Type and select “Incremental Int”. This will increase our collectable count by one when activated.

From the node we just created, drag the top arrow into a blank space in the event editor. Type and select “Print String”.

Connect the mint green arrow from the Incremental Int node to the magenta arrow of the Print String node.

Connect the top left arrow of the Incremental Int node to the white arrow of the “[Item]PickUp event”. When completed, our Event Graph should look like this.
Press Compile in the top left corner. We are now done with this blueprint. Let’s return to our collectable object blueprint.


In our collectable object blueprint, drag out from the right arrow of “Destroy Actor” and release. Type and select “Cast To BP_ThirdPersonGameMode”.
From the blue Object input of the new node on the left type and select “Get Game Mode”


Finally, from the right “As BP Third Person Game Mode” pin, type and select “[Item] Pick Up” (this is the function you named earlier). Your Event Graph should look like this.
Click compile and test. When you pick up your collectable you should see a “1” in the top left corner. If you place multiple collectables in the scene this number will increase further.