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 cannot bind an included function

If AddDynamic is used to bind an included function, it will throw the error 'no instance of function template"FComponentHitSignature::__Internal_AddDynamic" matches the argument list'.

 boundBox->OnComponentHit.AddDynamic(this, &UJumperMovement::OnCollide);

This is the code I attempted to use in my AJumper class. The "OnCollide" function was included from UJumperMovement, and I was trying to figure out why that error was being thrown despite the correct signature. Upon moving the "OnCollide" function to my AJumper class, and adjusting the AddDynamic parameters to match, no errors were thrown.

I can't imagine this is intended, as this is very inconvenient behavior.

Product Version: UE 4.16
more ▼

asked Aug 08 '17 at 10:18 PM in Bug Reports

avatar image

1 1 2 4

avatar image Tim C ♦♦ STAFF Aug 09 '17 at 05:59 PM

Hi quisciens,

I am not sure I completely understand the setup that you are using. Is AJumper a child class of UJumperMovement? Would you be able to provide a simplified version of the code in both classes so I can get a better idea of how they are related?


avatar image quisciens Aug 19 '17 at 01:56 PM

Sorry about the delayed response, but... I was about to attach related code before I realized I've lost it now. But, AJumper wasn't a child class of UJumperMovement. I seriously don't know why I said "inherited" instead of "included." Must've been pretty tired.

AJumper was an actor, while UJumperMovement was a pawn movement component, if I recall. Including the latter and attempting to use AddDynamic to bind its "OnCollide" function yielded an error identical to that of an incorrect function signature, which confused me for a while. Eventually, I moved that exact function, with no changes, to the AJumper class and AddDynamic worked fine.

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

1 answer: sort voted first

Hello quiesciens,

Sorry for not getting back to you sooner. I believe the issue that you were running into was that the compiler was trying to resolve the function in the AJumper class, and could not find a function that matched the signature in the UJumperComponent class because the binding was being made in the AJumper class instead of the UJumperComponent class. The AddDynamic() function needs a specific instance of a class in which to look for the specified function to run. In the example line that you provided, this tells the function that the &UJumperMovement::OnCollide is located in the current AJumper7 class.

Since UJumperMovement is included by AJumper (I am guessing that you added a UJumperMovement component to the AJumper class), you can tell AddDynamic() to look for the function in the component attached to the current class by using the following line:

 BoundBox->OnComponentHit.AddDynamic(JumperComponent, &UJumperComponent::OnCollide);

That should allow the compiler to properly resolve the function.


more ▼

answered Mar 02 '18 at 09:31 PM

(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