Hi!
From a Character class I’m calling a GameMode’s method that will destroy this Character class that is calling the method:
void ASCharacter::OnDied(AActor* InstigatorActor)
{
ASGameModeBase* GameMode = GetWorld()->GetAuthGameMode();
if (GameMode)
{
GameMode->OnActorKilled(this, InstigatorActor);
}
}
The GameMode method is:
void ASGameModeBase::OnActorKilled(AActor* VictimActor, AActor* Killer)
{
ASCharacter* Player = Cast(VictimActor);
if (Player)
{
// Other code…
Player->Destroy();
}
}
Could there be any issues that might arise from calling a method that will destroy the class that is calling it?
Thanks!