Using a custom spawn function to spawn a character will crash editor in PIE mode (only standalone window crashes if standalone is used).
UFUNCTION(BlueprintCallable, Category = Default) AActor* SpawnActor2(TSubclassOf<AActor> actorClass, AActor* actorTemplate, FVector position);
AActor* AFTickTaskManagerPlayerController::SpawnActor2(TSubclassOf<AActor> actorClass, AActor* actorTemplate, FVector position)
{
FActorSpawnParameters SpawnInfo;
SpawnInfo.bNoCollisionFail = true;
SpawnInfo.Owner = this;
SpawnInfo.Instigator = nullptr;
SpawnInfo.bDeferConstruction = false;
SpawnInfo.Template = actorTemplate;
auto world = GetWorld();
auto actor = world->SpawnActor<AActor>(actorClass, SpawnInfo);
actor->SetActorLocation(position);
return actor;
}
Head over to the existing Questions & Answers thread and let us know what's up.
| 0 |
| Component | UE - Gameplay |
|---|---|
| Affects Versions | 4.5.1 |
| Created | Dec 30, 2014 |
|---|---|
| Resolved | Mar 5, 2015 |
| Updated | Jul 14, 2021 |