x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

C++ Unpause

Question about unpause in C++

I have an action bind for pause/unpause in my character class that calls

UGameplayStatics::SetGamePaused(GetWorld(), !UGameplayStatics::IsGamePaused(GetWorld()));

in my player controller SetTickableWhenPaused(true);

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

thanks!

Product Version: UE 4.22
Tags:
more ▼

asked Apr 20 '19 at 05:08 PM in C++ Programming

avatar image

fmaacmab
51 2 7 9

avatar image GigasightMedia Apr 23 '19 at 06:54 PM

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?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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;
 menuBack.ActionDelegate.BindDelegate(this, FName("MenuBackPressed"));
 
 InputComponent->AddActionBinding(menuBack);

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.

more ▼

answered Apr 24 '19 at 09:55 AM

avatar image

phil_me_up
1.5k 6 6 12

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question