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"

AddDynamic Overlap Issue

Having an issue with AddDynamic. Here's the code.

UFUNCTION in header file

 UFUNCTION()
         void OnActorOverlap(class UPrimitiveComponent* OverlappingComp, class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult);


In the .cpp

 tBox = CreateDefaultSubobject<UBoxComponent>(TEXT("Root"));
     tBox->bGenerateOverlapEvents = true;
     //tBox->OnComponentBeginOverlap.__Internal_AddDynamic(this, &AmyActor::OnOverlap, OnOverlap);
     
     tBox->OnComponentBeginOverlap.AddDynamic(this, &AmyActor::OnActorOverlap);


Attached is the following error within visual studio alt text

I get

Error: No instance of function template "FComponentBeginOverlapSignature::__Internal_AddDynamic" matches the argument list argument types are (ClassName , void (ClassName::)(UPrimitiveComponent *OverlappingComp, AActor *OtherActor), FName) object type is: FComponentBeginOverlapSignature

I'm rather new to C++ & Unreal, thanks for looking over and any recommended books would be greatly appreciated

Product Version: UE 4.11
Tags:
adddynamicbug.png (12.4 kB)
more ▼

asked Mar 26 '17 at 10:38 PM in C++ Programming

avatar image

Doctor Mellow
1 1 1 2

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

Hi, try this function signature for the function you're trying to add dynamically instead. Not sure if you need to forward declare, so if it doesn't work you can add "class" to the needed function members.

 void OnActorOverlap(AActor* otherActor, UPrimitiveComponent* otherComp, int32 otherBodyIndex, bool bFromSweep, const FHitResult& sweepResult);




 
more ▼

answered Mar 27 '17 at 12:40 AM

avatar image

RoboScorpion
151 4 2 8

(comments are locked)
10|2000 characters needed characters left
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