OnComponentBeginOverlap is not being called

So I’m rather new to unreal and im attempting to create a hitbox system for a fighting game im trying to make, but the hitboxes themselves refuse to enter the function ive linked to OnComponentBeginOverlap… Here’s my function and mesh declarations

	//a mesh to show the hitbox
	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Hitbox Details")
	UStaticMeshComponent * hitbox;

	//hitbox collision function
	UFUNCTION(BlueprintCallable, Category="Hitboxes")
	void OnHit(UPrimitiveComponent* thisHitbox, AActor* otherActor, 
                          UPrimitiveComponent* otherComp, int32 otherBodyIndex,
                          bool bFromSweep, const FHitResult& SweepResult);

//and Here's my implementation

    //set collision types for the mesh and the actual hitbox
	hitbox->SetCollisionProfileName(TEXT("OverlapAll"));

	//set the hitbox to call OnHit when triggered
	hitbox->bGenerateOverlapEvents = true;
	hitbox->OnComponentBeginOverlap.AddDynamic(this, &AHitbox::OnHit);

	RootComponent = hitbox;

As for the function that im calling, all there is thats of note is a UE_LOG call right at the beginning so i can know whether the function has been entered

UPDATE:
Ok so the hitboxes are actually able to collide with each other, the issue is that a hitbox spawned dynamically through my code isnt colliding

SECOND UPDATE:
so my dynamically spawned hitboxes do in fact have collision, however they don’t actually enter my functions when they collide. Additionally, I tried setting a bGenerateOverlapEvents to false on my character’s capsule collider and that didn’t stop it from entering my function when i walked into the random hitbox i placed in the world. In conclusion, im really confused and if anybody has any internal knowledge that might at least help me figure this out (as in how collision is programmed and works in unreal) that would help. Also, ive already been the the basic this is how collision works in unreal page that has the table with how all their collision types interact with each other

FINAL UPDATE:
Ok so I figured out the answer. Turns out, if you used spawnActor with deferred construction so that your object would run its constructor, then after your actor is fully initialized you need to call FinishSpawning inside the actor itself and pass in its transform

When i check during runtime all of the collision presets are properly set to overlap

You sure you set up collion chanells and relations? because things can overlap but they can be set to ignore which makes things bypass collision code including event triggers

UStaticMeshComponent * hitbox; … Why? Why not UBoxComponent? If you use static mesh you have to setup Collision on the Mesh you will use with that component.

had to have a visual aspect on the hitboxes and I figured that since static meshes can have collision there wasn’t much point to creating a box component with it

Are you sure that static mesh has collision set up properly (The shape in static mesh editor)

It is showing a cube, and the collision works when i just place one of them in the scene and have it collide with another, the issue is that my dynamically spawned hitboxes arent colliding

Can you show the Full Code please? Where do you create yout SMComponent and where you Bind the event.

hitbox = CreateDefaultSubobject(TEXT(“hitboxMeshComponent”));
auto meshAsset = ConstructorHelpers::FObjectFinder(TEXT(“StaticMesh’/Game/StarterContent/Shapes/Shape_Cube.Shape_Cube’”));
if (meshAsset.Object != nullptr)
{
hitbox->SetStaticMesh(meshAsset.Object);
}

	hitbox->SetCollisionProfileName(TEXT("OverlapAll"));
	hitbox->Mobility = EComponentMobility::Movable;

	//set the hitbox to call OnHit when triggered
	hitbox->bGenerateOverlapEvents = true;
	hitbox->OnComponentBeginOverlap.AddDynamic(this, &AHitbox::OnHit);

	RootComponent = hitbox;

And im creating all this and binding it inside the constructor

And if you’re asking where i create the component in the world, its in a spawnActor function on the player that does this

FVector tempVec;
	tempVec = GetTransform().GetLocation();
	FRotator rot(GetTransform().GetRotation());
	FActorSpawnParameters sp = FActorSpawnParameters();
	sp.bDeferConstruction = true;

	tempHitbox = ()->SpawnActor<AHitbox>(AHitbox::StaticClass(),tempVec, rot, sp);
	tempHitbox->GetTransform().SetLocation(tempVec);

	FAttachmentTransformRules rules(EAttachmentRule::SnapToTarget, EAttachmentRule::SnapToTarget, EAttachmentRule::KeepRelative, true);
	tempHitbox->AttachToComponent(RootComponent, rules);

	tempHitbox->SetHitboxProperties(type, offset, dimensions, damage);

	hitboxes.Add(tempHitbox);
	return tempHitbox;

Final note since this wasn’t tagged as answered and I just realized that:
If you used spawnActor with deferred construction so that your object would run its constructor, then after your actor is fully initialized you need to call FinishSpawning inside the actor itself and pass in its transform