OnActorEndOverlap event does not fire

I have a player class that has custom Begin and End overlap behaviour. I have OnActorBeginOverlap working properly, by using:

OnActorBeginOverlap.AddDynamic(this, &AZrnTheftAutoCharacter::ActorOverlap);

// Header file
UFUNCTION()
void ActorOverlap(class AActor* Self, class AActor* OtherActor);

// Implementation
void AZrnTheftAutoCharacter::ActorOverlap(class AActor* Self, class AActor* OtherActor)
{
#ifdef UE_BUILD_DEBUG
    GEngine->AddOnScreenDebugMessage(0, 2.0f, FColor::Green, "Overlapping");
#endif
    ATP_VehicleAdvPawn* otherVehicle = Cast<ATP_VehicleAdvPawn>(OtherActor);

    if (otherVehicle)
    {
#ifdef UE_BUILD_DEBUG
        GEngine->AddOnScreenDebugMessage(1, 2.0f, FColor::Green, "Overlapping with vehicle");
#endif
        vehicle = otherVehicle;
    }
}

This all works fine. I have OnActorEndOverlap added to an ActorEndOverlap method in an identical way. However, it isn’t writing the debug statement, so I am assuming that the ActorEndOverlap method is never being called, and I don’t know why.

The OnActorEndOverlap code is:

OnActorEndOverlap.AddDynamic(this, &AZrnTheftAutoCharacter::ActorEndOverlap);

// Header
UFUNCTION()
void ActorEndOverlap(class AActor* Self, class AActor* OtherActor);

// Implementation
void AZrnTheftAutoCharacter::ActorEndOverlap(class AActor* Self, class AActor* OtherActor)
{
#ifdef UE_BUILD_DEBUG
    GEngine->AddOnScreenDebugMessage(-1, 2.0f, FColor::Red, "Overlap ended");
#endif
}

It would be easier for us to help if the code that didn’t work as expected was included as well.

Ok, added that in.

Do you have bGenerateOverlapEvents set to true on the root primitive component (which should be a collision component) for all actors involved?

I do; the BeginOverlap event fires properly and my code receives it.

What are the collision presets set to?

I copied and pasted your code to my project on version 4.9 and it worked as expected. There was a compilation error using your code. The UFUNCTIONs had to read like this to compile for me:

UFUNCTION()
void ActorOverlap(class AActor* OtherActor);

UFUNCTION()
void ActorEndOverlap(class AActor* OtherActor);

Updated the parameters in the .cpp:

void AZrnTheftAutoCharacter::ActorOverlap(class AActor* OtherActor)
{
	GEngine->AddOnScreenDebugMessage(-1, 2.0f, FColor::Red, "Overlap Begun");
}

void AZrnTheftAutoCharacter::ActorEndOverlap(class AActor* OtherActor)
{
	GEngine->AddOnScreenDebugMessage(-1, 2.0f, FColor::Red, "Overlap Ended");
}

In my constructor I generate my collision root primitive and the the root component to it:

MySphereColl = CreateDefaultSubobject<USphereComponent>(TEXT("MySphereColl"));
MySphereColl->SetCollisionProfileName(TEXT("BlockAll"));
MySphereColl->SetCollisionEnabled(ECollisionEnabled::PhysicsOnly);
MySphereColl->InitSphereRadius(35.0f);
MySphereColl->bGenerateOverlapEvents = true;
// Set the SphereComponent as the root component. 
RootComponent = MySphereColl;

The object I had my actor collide with was a static mesh actor with collision set to “BlockAll” and “Generate Overlap Events” on.

It wouldn’t work in 4.9, because I’m on 4.12 and the API appears to have changed; the documentation is yet to catch up. Providing one AActor in the method signature doesn’t work. To answer your previous question, the presets are set to Pawn for the character, Vehicle for the vehicle. The collision presets are fine as it calls the BeginOverlap. It’s just for some reason not calling EndOverlap.

It appears the 4.12.1 hotfix corrected the error, as the debug message is now appearing, while I haven’t changed any code.