0

I'm a begginer, trying to finish a simple UE4 C++ tutorial: https://www.raywenderlich.com/185-unreal-engine-4-c-tutorial#toc-anchor-001 At the point where you're additing OnActorBeginOverlap.AddDynamic(this, &ABaseCoin::OnOverlap) into ABaseCoin constructor in order to handle the event, it's just not working. the OnOverlap function is not being called when I overlap this actor( But if I put OnActorBeginOverlap.AddDynamic into ABaseCoin::BeginPlay everything is working. Please, help, who knows something about this problem

CloudKicker
  • 3
  • 1
  • 5

1 Answers1

4

Problems arise when using .AddDynamic in the constructor now. It can also cause Blueprint corruption.

Put every constructor .AddDynamic in PostInitializeComponents() or BeginPlay()

boocs
  • 456
  • 1
  • 3
  • 5
  • 1
    Thanks for replying! PostInitializeComponents works for me! – CloudKicker Nov 15 '20 at 08:32
  • it works, but it will result a error 'Ensure condition failed: InvocationList[ CurFunctionIndex ] != InDelegate' at every first load Level/Editor, but in game, it works fine. – krosshj Aug 06 '21 at 08:12