Hi everyone! I’m pretty new to Unreal Engine and just started learning gameplay programming with C++. Right now, I’m trying to build a very basic item pickup system. I’ve created an AItem
class, and I want to trigger a custom event (like playing a sound or increasing the player’s score) when the player overlaps with the item and presses a key (e.g., ‘E’).
I’ve managed to set up the overlap detection using OnActorBeginOverlap
, and I also bound input in the ACharacter
class, but I’m not sure how to correctly reference the item and trigger a function inside it. Do I need to use an interface or cast the overlapping actor? Or is there a more elegant way to handle this in Unreal C++?
Any advice, examples, or even a quick breakdown of best practices when structuring this kind of interaction would really help me. Thanks in advance!