OnClicked Parameters

Hello,

So i was wondering what parameters my OnClick function would need, not much else. I have searched through the docs but i have found nothing, everything seems to be focused on blueprint :confused:

this is what im using:
col = PCIP.CreateDefaultSubobject(this, TEXT(“light”));
col->OnClicked.AddDynamic(this, &AMyActor::OnClick);

Hi,

Try this code

Void OnClick(UPrimitiveComponent* pComponent)
{
	// to do smth
}

Cheers,

Thank you :slight_smile:

For newer people to the UE4 (I couldn’t find any example online of this so I thought I’d post)
When updating from 4.9.2 to 4.12.1 I had to change my onclicked functions to be

void OnClick(UPrimitiveComponent* pComponent, FKey inKey)
{
//do stuff
}

“, FKey inKey” that little bit was killing my brain… Thank you so much! the jump from 4.11 to 4.12 was much more painful than it needed to be because of that tiny (useful) addition.

Is the pComponent a component that got clicked?

thanks a lot