DemoPlay can't spawn custom spectator class
I'm on version: Version: 4.8.3-0+++depot+UE4-Releases+4.8 with the github source.
I reckon the demo (demorec, demoplay, etc) is still in it's infant's shoes.
I'm binding to the PostDemoPlay delegate like so:
The difficulty here is that obviously the demoplay command doesn't allow specifying a custom playercontroller class. It simply spawns the PendingLevelPlayerControllerClass in ULocalPlayer::SpawnPlayActor(...) called from UWorld::LoadMap(...) (LoadMap is called by: UDemoNetDriver::InitConnectInternal(...)). Even though there exists a UDemoNetDriver::DemoSpectatorClass which can be specified via config, this is not used when setting up a demoplay PlayerController.
Now, trying to spawn my own MyPlayerController class after PostDemoPlay has been broadcasted, it simply fails because the UWorld I receive from ULocalPlayer::GetWorld() doesn't have a CurrentLevel:
yields the same error.
I currently find no way of spawning my own spectator PlayerController class in a demoplay environment.
According forum thread: https://forums.unrealengine.com/showthread.php?79867-Spawning-actor-during-demoplay
It is possible to use your own PlayerController class for this, but it has to be known when the replay is recorded, so that an actor of this type can be spawned and recorded in the replay. Also, the way you specify this class has changed in 4.9.
In 4.9, you'll need to set the ReplaySpectatorPlayerControllerClass property on the GameMode class.
In 4.8, the class is set through the config property
ShooterGame uses a custom spectator controller for replays, so feel free to use it as an example!
answered Aug 11 '15 at 08:01 PM
Ryan Gerleve STAFF
Follow this question
Once you sign in you will be able to subscribe for any updates here