Website powered by

How did I deal with… Testing a Pickup Counter BP function in Unreal Engine and writing it in C++.

Inside the prototype, I'm writing a counter that adds items every time I collect a pickup. I’m reusing the interaction method to update my UI via Interface. This is the translation for this first function in C++, in the source file of Player Character, Interact Function:

if (Interface && (MissionAccomplished == false))
{
Interface->Execute_OnInteract(OverlappedActor, this);
CollectedItems++;
Add_Item.Broadcast();
}

At the end of the conditional, I'm replacing the interface through a delegate, which allows me to send different messages to the UI from C++, reserving the interface for interaction with the pickups only. Visit the original article here: https://www.3dartviz.com/skills/skills-tech/programming-video-game-interaction-cpp.html#counter

The pickups counter updates the number of collected items.

The pickups counter updates the number of collected items.