Hi guys, i read some posts about it, but could not understand how to solve this problem.
.h
UFUNCTION() void blockClicked (UPrimitiveComponent* ClickedComp);
Last string error:
.cpp
void AMyBox::blockClicked(UPrimitiveComponent* ClickedComp)
{
randColor();
}
void AMyBox::createBlock()
{
DummyRoot = CreateDefaultSubobject<USceneComponent>(TEXT("Dummy0"));
RootComponent = DummyRoot;
class UStaticMesh* BlockStatickMesh;
BlockStatickMesh = ConstructorHelpers::FObjectFinderOptional<UStaticMesh>(TEXT("StaticMesh'/Game/MyBlock.MyBlock'")).Get();
BlockMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("BlockMesh0"));
BlockMesh->SetStaticMesh(BlockStatickMesh);
TempMaterial = ConstructorHelpers::FObjectFinderOptional<UMaterial>(TEXT("Material'/Game/Blue.Blue'")).Get();
BlockMesh->SetMaterial(0, TempMaterial);
BlockMesh->AttachTo(DummyRoot);
BlockMesh->OnClicked.AddDynamic(this, &AMyBox::blockClicked);//there is no instance //of function template matches the argument list.
}
1 Like
Steve_Robb
(Steve Robb)
2
Hi,
As of UE 4.12, your event handler will need to be defined to take an extra FKey parameter:
“OnClick/OnReleased events now have an additional argument that specifies which key was responsible for the event.”
Hope this helps,
Steve
1 Like
Thanks, you pointed me in the right direction.
If someone will face with a similar problem:
.h
UFUNCTION() void blockClicked(UPrimitiveComponent* ClickedComp, FKey ButtonPressed);
.cpp
UFUNCTION() void AMyBox::blockClicked(UPrimitiveComponent * ClickedComp, FKey ButtonPressed)
{
randColor();
return UFUNCTION() void();
}
void AMyBox::createBlock()
{
DummyRoot = CreateDefaultSubobject<USceneComponent>(TEXT("Dummy0"));
RootComponent = DummyRoot;
class UStaticMesh* BlockStatickMesh;
BlockStatickMesh = ConstructorHelpers::FObjectFinderOptional<UStaticMesh>(TEXT("StaticMesh'/Game/MyBlock.MyBlock'")).Get();
BlockMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("BlockMesh0"));
BlockMesh->SetStaticMesh(BlockStatickMesh);
TempMaterial = ConstructorHelpers::FObjectFinderOptional<UMaterial>(TEXT("Material'/Game/Blue.Blue'")).Get();
BlockMesh->SetMaterial(0, TempMaterial);
BlockMesh->AttachTo(DummyRoot);
BlockMesh->OnClicked.AddDynamic(this, &AMyBox::blockClicked);
}