Skip to content

Instantly share code, notes, and snippets.

@dorgonman
Created June 30, 2018 16:23
Show Gist options
  • Save dorgonman/8f4260d63ac09cde2c5fec60b346544b to your computer and use it in GitHub Desktop.
Save dorgonman/8f4260d63ac09cde2c5fec60b346544b to your computer and use it in GitHub Desktop.
wordpress_post1583_05.cpp
// Statically bind to the specified player controller
UClass* PCClass = PendingLevelPlayerControllerClass;
// The PlayerController gets replicated from the client though the engine assumes that every Player always has
// a valid PlayerController so we spawn a dummy one that is going to be replaced later.
//
// Look at APlayerController::OnActorChannelOpen + UNetConnection::HandleClientPlayer for the code the
// replaces this fake player controller with the real replicated one from the server
//
FActorSpawnParameters SpawnInfo;
SpawnInfo.ObjectFlags |= RF_Transient; // We never want to save player controllers into a map
PlayerController = InWorld->SpawnActor<APlayerController>(PCClass, SpawnInfo);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment