Collisionbox event only works once

Hello,
I have attached a collisionbox to an Actor and everytime my character is colliding with it i am creating a new floor tile but it only works on the first collisionbox.
here is my code :

void AFloor::BeginPlay()
    {
    	Super::BeginPlay();	
    	Collisionbox->OnComponentBeginOverlap.AddDynamic(this,&AFloor::CheckCollision);
    }

void AFloor::CheckCollision(UPrimitiveComponent* OverlappedComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
	 if ((OtherActor != nullptr) && (OtherActor != this) )
	{
		SpawnFloor(); // here i spawn a Bluepring floor tile actor
	}
}

Thank you for your help

Collisionbox->OnComponentBeginOverlap.AddDynamic(this,&AFloor::CheckCollision);
Move this section of the code to the constructor and add an keyword virtual infornt of your check collision function in the .h file

E.g.

UFUNCTION()
virtual void CheckCollision();

Can you show your construction code?

you should not bind delegates without good reason on the constructor.

Your CheckCollition signature is different between your header and cpp

My mistake, meant to add a comment, not an answer.

@philex are you sure your newly spawned collisionbox is attached and in the expected location?

That would cause a compile error. which he stated is not happening. So this answer is not valid. He said its overlapping once only.

Also why does virtual matter?

Well by default i don’t know why but if your function does not have the name OnOverlapBegin() the function does not get a call. But adding the virtual keyword lets you overide that as well as helps if you are going to create a child class.