UnrealScripterAI
Discord ↗
Link Copied to Clipboard
×
"create a zombie spawner"
// Called when the game starts or when spawned void AZombieSpawner::BeginPlay() { Super::BeginPlay(); // Spawn a zombie every few seconds GetWorldTimerManager().SetTimer(ZombieSpawnTimer, this, &AZombieSpawner::SpawnZombie, SpawnInterval, true); } // Spawn a zombie void AZombieSpawner::SpawnZombie() { FVector SpawnLocation = GetActorLocation(); FRotator SpawnRotation = GetActorRotation(); GetWorld()->SpawnActor<AZombie>(ZombieClass, SpawnLocation, SpawnRotation); }