How do I use OnClicked to get a reference to character?

I have an item class with an OnClicked event added. I want to call a function on the local character that clicked on the item. How do I get that reference to the character?

// In constructor
MeshGround->OnClicked.AddDynamic(this, &ATDSItem::ItemOnClicked);

// In my Item class
void ATDSItem::ItemOnClicked(UPrimitiveComponent* ClickedComponent)
{
	// Get reference to character that clicked on item and call function passing reference to this item.
	GEngine->AddOnScreenDebugMessage(-1, 3.0f, FColor::Green, TEXT("Mouse clicked on item."));
}

Figured it out:

ATDSCharacter* myChar = Cast(GetWorld()->GetFirstPlayerController()->GetCharacter());

Edit: If there’s a better way to do this let me know! :slight_smile: