x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

OnClicked.AddDynamic(this, &Function); error

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.
     }


Product Version: UE 4.14
Tags:
more ▼

asked Feb 07 '17 at 08:59 PM in C++ Programming

avatar image

Ganozery
1 2 3 3

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Hi,

As of UE 4.12, your event handler will need to be defined to take an extra FKey parameter:

https://docs.unrealengine.com/latest/INT/Support/Builds/ReleaseNotes/2016/4_12/

"OnClick/OnReleased events now have an additional argument that specifies which key was responsible for the event."

Hope this helps,

Steve

more ▼

answered Feb 07 '17 at 10:05 PM

avatar image

Steve Robb STAFF
2.8k 58 31 101

avatar image Ganozery Feb 08 '17 at 07:45 PM

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);
 }

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question