ActorBeginOverlap Not firing in code [Resolved]

Hi,

I’ve looked through all the other questions related to ActorBeginOverlap problems but it seems no one is having the same issue, therefore I’m obviously missing something but I’ve not idea what.

Here is the problem:

I have two actor subclasses (one is a APaperCharacter the other a AActor). In each of these classes I have methods I wish to be fired on the Event ActorBeginOverlap. These are UFUNCTIONS with the correct Delegate signature for ActorBeginOverlap (void FunctionName (AActor* OverlappingActor, AActor* Other))

In the constructor of each class I am registering the delegate with OnActorBeginOverlap.AddDynamic(this, &MyClassNames::DelegateFunction)

Everything compiles fine, However when i run in the editor the events don’t fire when overlapping each other.

I checked to see if the collision properties were incorrect by getting the overlapping actors in the AActor::Tick function every frame and things worked fine this way, the correct actors overlap but I don’t want to check for this every tick. I want the event to fire.

I should probably mention that, NotifyActorBeginOverlap(AActor* OtherActor) works correctly when each actor is overlapping another actor. I suppose I could use this function but it seems the correct practice is setting a multicast_delegate.

I created a blueprint based off the too classes and tried calling the parent function but this didn’t work either.

Things also worked correctly when i visually scripted the functionality using Event ActorBeingOverlap in blueprints, however I don’t want this done in Blueprint. I want the code to fire =/

Assuming the Collision Channels are correct, the function signatures match and the UFUNCTION() macro is in place, is there anything else that is needed to make this work?

NOTE: I’ve also tried using OnComponentBeginOverlap on the capsule component but the event still failed to fire.

APaperCharacter class (compiles but doesn’t fire ActorBeginOverlap Event from code)

class AMartianCharacter : public APaperCharacter
{
GENERATED_BODY()

	virtual void BeginPlay() override;

	virtual void Tick(float DeltaSeconds) override;

	virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;

protected:
	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true"))
	class UCameraComponent* PlayerCameraComponent;
	
	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true"))
	class USpringArmComponent* CameraBoom;

private:

	UFUNCTION()
	void OnActorOverlap(AActor* OverlappingActor, AActor* Other);

UFUNCTION()
virtual void NotifyActorBeginOverlap(AActor* OtherActor) override;

	UFUNCTION()
	virtual void NotifyActorBeginOverlap(AActor* OtherActor) override;

};

AMartianCharacter::AMartianCharacter()
{

PrimaryActorTick.bCanEverTick = true;
PrimaryActorTick.bStartWithTickEnabled = true;

SetupCameraObject();
InitFlipbookAnimationsAndComponents();

OnActorBeginOverlap.AddDynamic(this, &AMartianCharacter::OnActorOverlap);
OnActorEndOverlap.AddDynamic(this, &AMartianCharacter::OnActorOverlapEnd);

}

void AMartianCharacter::OnActorOverlap(AActor* OverlappingActor, AActor* Other)
{
UE_LOG(LogTemp, Warning, TEXT(“Overlap Event.”));

}

void AMartianCharacter::NotifyActorBeginOverlap(AActor * OtherActor)
{
UE_LOG(LogTemp, Warning, TEXT(“Player overlapping”));

}

Turns out setting a UPaperSpriteComponent as the RootComponent was causing the Overlap event to not fire.

Switched from:

RootComponent = SpriteComponent;

To:

SpriteComponent.AttachTo(RootComponent);