Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void AActorSpawner::BeginPlay()
- {
- Super::BeginPlay();
- FTimerHandle OutHandle;
- //Will call SpawnUsefulActor after the specified time
- GetWorld()->GetTimerManager().SetTimer(OutHandle, this, &AActorSpawner::SpawnUsefulActor, TimeToSpawn);
- }
- void AActorSpawner::SpawnUsefulActor()
- {
- //If the usefulactorbp is valid
- if(UsefulActorBP)
- {
- //Spawn parameters for the current spawn.
- //We can use this for a number of options like disable collision or adjust the spawn position
- //if a collision is happening in the spawn point etc..
- FActorSpawnParameters SpawnParams;
- //Actual Spawn. The following function returns a reference to the spawned actor
- AUsefulActor* ActorRef = GetWorld()->SpawnActor<AUsefulActor>(UsefulActorBP, GetTransform(), SpawnParams);
- GLog->Log("Spawned the UsefulActor.");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement