How do you start a player as spectator, or switch him to spectator via Blueprint? All of the solutions I have found are C++ specific (use ChangeState and bIsSpectator, etc). ChangeState does not seem to be exposed to BP and bIsSpectator cannot be changed in BP either.
I imagine I can spawn a Spectator pawn and possess it, but I doubt that’s the solution since I don’t think that changes the player’s actual state to spectator.
For anyone else who finds this, I came across the same problem. Changing a player to spectator mode seems like it really ought to be exposed to blueprints.
If you are making a c++ project and want to expose ChangeState to blueprints, the answer is to create a c++ class derived from PlayerController.
Then your PlayerController blueprint is derived from MyPlayerController. If you already have a playercontroller blueprint, you can easily change the parent class in ‘blueprint settings.’
The ChangeState function will automatically spawn a SpectatorPawn and possess it.
If your game is multiplayer I think you have to call your new blueprint functions on the server and the client.
This code works almost properly, but after changing state this way GameMode function GetNumPlayers() and GetNumSpectators() will return wrong value.
This code fixes it.
any reason why this isnt exposed to blueprint ? When i choose to make a blueprint project only, i expect to be blueprint only but if EPIC dont expose everything for blueprint its impossible to do it only blueprint… Can we make a game with blueprint only or we always have to expose things ourself in c++ …