Из класса символов я вызываю метод GameMode, который уничтожит этот класс символов, вызывающий этот метод:
Код: Выделить всё
void ASCharacter::OnDied(AActor* InstigatorActor)
{
ASGameModeBase* GameMode = GetWorld()->GetAuthGameMode();
if (GameMode)
{
GameMode->OnActorKilled(this, InstigatorActor);
}
}
Код: Выделить всё
void ASGameModeBase::OnActorKilled(AActor* VictimActor, AActor* Killer)
{
ASCharacter* Player = Cast(VictimActor);
if (Player)
{
// Other code…
Player->Destroy();
}
}
Подробнее здесь: https://stackoverflow.com/questions/798 ... calling-it
Мобильная версия