👩💻 Join our community of thousands of amazing developers!
一种不推荐的写法: FActorSpawnParameters SpawnInfo; SpawnInfo.Instigator = Instigator; SpawnInfo.ObjectFlags |= RF_Transient; // We never want to save player controllers into a map SpawnInfo.bDeferConstruction = true; AMyPlayerController* NewPC = GetWorld()->SpawnActor<AMyPlayerController>(AMyPlayerController::StaticClass(), SpawnLocation, SpawnRotation, SpawnInfo); 参考自AGameMode::SpawnPlayerController()函数: APlayerController* AGameMode::SpawnPlayerController(ENetRole RemoteRole, FVector const& SpawnLocat...