How to set game Pause when i press key? I need use APlayerController::Pause or something another?
Why don’t you try?
Need to write custom PlayerContoller class? I tried call APlayerController::Pause but it not work.
Should be able to call SetPause (on the player controller)
How i can do it correctly?
Your probably going to want to add something to your GameMode or GameState to go this, then add a function along the lines of:
void AYourGameState::SetGamePaused(bool bIsPaused)
{
APlayerController* const MyPlayer = Cast<APlayerController>(GEngine->GetFirstLocalPlayerController(()));
if (MyPlayer != NULL)
{
MyPlayer->SetPause(bIsPaused);
}
}
1 Like
Thank you :). I add this function to my Character class.