Assertion is rare but hit by this line:
void AEmotionBullet::BeginPlay()
{
Super::BeginPlay();
OnActorBeginOverlap.AddUniqueDynamic(this, &AEmotionBullet::TriggerEmotionalResponseInAI); //call stack from the assert leads up to here.
}
I believe it has something to do with trying to register multiple times with the Tick function. In EmotionBullet’s constructor its ticking is set like so:
this->SetActorTickEnabled(false);
And the bullet is created by the PlayerCharacter like so:
AEmotionBullet * SpawnedBlueprintBullet = (GetWorld())->SpawnActor<AEmotionBullet>(SpawnedBlueprintBulletClass, SpawnLocation, GetActorRotation() , SpawnParams);
check(SpawnedBlueprintBullet != nullptr);
if (SpawnedBlueprintBullet)
{
SpawnedBlueprintBullet->Origin = SpawnLocation;
SpawnedBlueprintBullet->Target = EndLocation;
SpawnedBlueprintBullet->BulletType = StoredEmotionToFire;
SpawnedBlueprintBullet->ToggleMaterialTransition();
SpawnedBlueprintBullet->FlyToTarget(); //this function will set TickEnabled to true at the end.
}
Is the problem that it’s trying to go through it all in one frame and register with Tick twice or am I on the wrong track? Would moving the OnActorBeginOverlap delegate registration up to the constructor prevent this?