Arrow components - Click event

Hi!

I have to render arrows in the three axis and manage the click events on this arrows to move the actors. I created an actor with some components, in which are included the arrow components (defined in ArrowComponent.h). The problem is that the click events never fire in these components.

Code used to set the event in the BeginPlay function:

flechaX->OnClicked.AddDynamic(this, &ALuz::onClickFlecha);

And the code of the function:

void ALuz::onClickFlecha(UPrimitiveComponent* pComponent){
	FString s = "Click";
	GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, s);
}

I tried with other component in the same way and it worked, but no with the arrow. Maybe a collision mesh problem?

Thank you.

Actor and Component click events use collision system, if your actor/component can’t collide it can’t be clicked, arrow component if im not mistaken is visual only, so use same extra shape component around arrow component like UCapsuleComponent

Solved adding a UBoxComponent to manage clicks on the arrows.

Code for one arrow:

In the .h:

 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Components")
 class UBoxComponent* colisionFlechaX;

In the constructor in the .cpp:

 colisionFlechaX = CreateDefaultSubobject<UBoxComponent>(TEXT("colisionFlechaX"));
 colisionFlechaX->SetBoxExtent(FVector(70,10,10));
 colisionFlechaX->AttachTo(modeloLuz);
 colisionFlechaX->RelativeLocation = FVector(35, 0, 0);
 colisionFlechaX->SetSimulatePhysics(false);
 colisionFlechaX->bGenerateOverlapEvents = false;
 colisionFlechaX->SetCollisionProfileName(TEXT("BlockAll"));

In the BeginPlay event in the .cpp:

 UWorld* World = ();
 World->GetFirstPlayerController()->bEnableMouseOverEvents = true;
 modeloLuz->OnBeginCursorOver.AddDynamic(this, &ALuz::onClickModelo);
 colisionFlechaX->OnClicked.AddDynamic(this, &ALuz::onClickFlechaX);

Then now only have to implement the onClickFlechaX function.

Thank you!. I solved it using your advice