My player pawn is extended from Character class. In C++, I use GetCapsuleComponent() to get collision component , and then I use “OnComponentBeginOverlap” to call my function ,when my pawn overlaps other actors (in my case, Pickup actor).
Based on UE4 Documents I have to use codes something like this:
Hi and thank you for reply.
I know that I have to define a function for OnOverlapBegins (and I did) , But my problem is as I explained. When I type GetCapsuleComponent()->OnComponentBeginOverlap the visual studio intellisense does not show AddDynamic() and it just contains “Add” , “AddUnique” , “__Internal_AddDynamic” and “__Internal_AddUnique” …! and there is not any AddDynamic() …
That is just because Intellisense isn’t always correct or robust enough to show everything.
To clarify, just because Intellisense doesn’t function, doesn’t mean the code is wrong. There are many instances where Intellisense gives false information because Visual Studio can be quite slow or plain wrong.
I’m guessing you’re using Visual Studio for your project. You could always try adding Jetbrains ReSharper C++ plugin, and that should improve the intellisense outside of some macros.
The reason you want to put this in BeginPlay() is that UE4 uses class default objects, which have different behavior based on how they are constructed. There’s a thread on this that explains a lot. Make sure that you have NO runtime code in your constructor; for example, if you try to use a value that is a UPROPERTY() in the constructor, that variable value won’t be set by a Blueprint child class at that time, so you will get the default value.
In case someone else wonder - the real reason is that delegates has no “AddDynamic” method at all, hence intellisence provides no such option for you. “AddDynamic” is a helper macro which expands into __Internal_AddDynamic() call and make it easier to format parameters for you.
I thought this was the case but for me the opposite was true. I had it in BeginPlay() and events would not fire but when I moved it to constructor the overlap events worked.