Question about unpause in C++
I have an action bind for pause/unpause in my character class that calls
in my player controller
in my player controller tick
if (IsPaused()) TickPlayerInput(DeltaTime, IsPaused());
it ticks once, and that’s it
it pauses the game fine, but cannot unpause
Can you provide more context for those lines? Is there more to your PC tick function?
Can you show the function that processes Pause and UnPause input?
What does TickPlayerInput do?
Are you sure it’s not ticking? Could it be ticking, but not unpausing?
Is your action binding actually getting called when the game is paused? (add a breakpoint or stick in a UE_LOG to check).
If it’s not then try binding using something like this instead (replace method names and InputComponent as needed)
FInputActionBinding menuBack = FInputActionBinding(FName("MenuBack"), IE_Released);
menuBack.bExecuteWhenPaused = true;
You could also write this as something like:
InputComponent->BindAction("MenuBack", IE_Pressed, this, &ThisClass::MenuBackPressed).bExecuteWhenPaused = true;
(Code written from memory, may not be completely correct).
Note the bExecuteWhenPaused flag being set to true.