OnTakeDamage access violation on DamageEvent
This is declaration of the TakeDamage method:
I have there UFUNCTION just to be able to use it to create the delegate. This is working fine without any problems, if I don't use DamageEvent in the method. But if I try to use DamageEvent, I have "Access violation executing location". Just simply calling this, is causing the crash:
Another question, beside the obvious why it is crashing, would be how to bind raw functions (methods) to delegates (in many places there are answers like BindRaw, AddDynamic, but these are not present in OnTakeDamage event).
Well, I have found out what is the problem. I am doing it entirely wrong.
Finally I have found the way how to do it properly. AddDynamic is not a method but it is a macro, that is why I could not find it. So jush use OnTakeDamage.AddDynamic(this,&ClassName::TakeDamage);
The delegate method declaration now looks like this:
answered Apr 15 '15 at 10:45 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here