My OnComponentBeginOverlap Doesnt Work?

My On Component Begin Overlap Doesn’t work? 4.7.2

Code CPP

CollisionComp = PCIP.CreateDefaultSubobject<USphereComponent>(this, TEXT("SphereComp"));
	CollisionComp->InitSphereRadius(5.0f);
	CollisionComp->AttachTo(RootComponent);
	CollisionComp->OnComponentBeginOverlap.AddDynamic(this, &APlayerCharacter::StartOverlap);
	CollisionComp->OnComponentEndOverlap.AddDynamic(this, &APlayerCharacter::EndOverlap);
	CollisionComp->bGenerateOverlapEvents = true;

void APlayerCharacter::StartOverlap(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
    {
    	GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Start"));
    }
    
    void APlayerCharacter::EndOverlap(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex)
    {
    	GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Stop"));
    }

Header

UPROPERTY(VisibleDefaultsOnly, Category = Default)
		USphereComponent* CollisionComp;

	UFUNCTION()
		void StartOverlap(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult);

	UFUNCTION()
		void EndOverlap(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex);

Hmm it should work, have you tried to do this with AActor object?
Maybe there are some problems using it in the APlayerController

I am using it in a player Character

I’ve tried it with a Character and it works,
Have you tried to create a BP from the Character class, and place it somewhere?
btw: 5.0f for radius is very small, maybe too small to hit it :slight_smile:

Thanks for your help, I fixed my problem! :smiley:

I didn’t realize that you had to enable generate overlap events on BOTH objects?

Hmm never had to do that :stuck_out_tongue: but it’s great to hear you solved the problem