by Jon (Updated on 2014-01-26)

Pausing is such a common feature that we decided to include it in the Stencyl engine itself.

We opted for a simple approach to pausing: pause everything and you tell us what should remain active. This gives you full control, and at the same time, it minimizes the amount of work on your part.


  • Pausing
  • Opting Out (Staying Active)
  • Example: Simple Pause/Unpause


Pausing freezes all “When Updating” events for Actors and all physics, unless you opt them out of pausing. In contrast, All “When Updating” events for Scenes are unaffected by pausing.

All Drawing Events still happen.

To pause and unpause the game, use these blocks under Scene > Game Flow.

Note: What about "do every N seconds" events? These also remain active. If you wish to pause them, wrap their contents in an if-statement checking whether the game is not paused.

Opting Out an Actor (Staying Active)

Often, you’ll want some Actors to remain active while the game is paused.

To opt an Actor out, flip to its Physics > Advanced page. Select “No” for this option.



Example: Simple Pause/Unpause

Notice that pausing preserves the full state of the actors. The ball will continue at the exact same trajectory as before. Here's how this example works.

Event 1: Toggling the Pause State

This part toggles between paused and unpaused when you press the spacebar.

Event 2: Tinting the Screen when Paused

This part darkens the screen a little when while the game’s paused by drawing a semi-transparent black rectangle on top of everything.


  • Pausing affects all actors by default.
  • Pausing stops updates to actors but does not affect scene behaviors/events.
  • Opt actors out to keep them active.


Challenge: Pause “Spell”

Who said that pausing had to be used just to pause the game? Let’s use pausing to create a Pause “Spell”, one that causes all enemies in a scene to freeze temporarily.

Create a game in which picking up a “timer” item will, for 30 seconds, cause all enemies to freeze up. Everything else will operate normally, including the player.

Disclaimer: All articles are geared towards Stencyl 3.0 and above. Use comments to provide feedback and point out issues with the article (typo, wrong info, etc.). If you're seeking help for your game, please ask a question on the forums. Thanks!


We could not get it to "unpause", as we were using an Event attached to a Pause Actor Button for pause / unpause code blocks.

FIX was to do the following:
1) Set Button as part of the Button Group, not general Actor Group
2) Button Actor / Physics / Advanced / "Can be Paused?" set to "No"
The second seemed the most important, as if the button can be paused, when in a pause state, that Pause Button Actor will be disabled as well.
When it cannot be paused, it enables the "unpause" functionality.

This is described above, but it is easy to forget the Pause Button (if used) is an actor of whatever type you set, and is also impacted by the Pause event, unless turned off as described above.

0 1 month, 2 weeks ago
Great tutorial! But 2 things, the example game is not working anymore, and I've seen lots of Stencyl games with the same pause menu that has up and down volume and mute volume. I'm talking about the one like on this game: http://www.stencyl.com/game/play/10 632
0 1 month, 3 weeks ago
I'm using Stencyl 3.1.
I have a scene behaviour (which should not be paused, right?) and some commands within WhenGameIsPaused wrapper.
Still the commands are not executed until I UNpause the game.
Am I doing smthg wrong or...?
screenshot http://clip2net.com/s/il3Nsy

0 1 year, 3 months ago
What this article misses is a clear explanation that you can unpause game only if you are checking whether game is paused in "When Updating" or "When Drawing" events...
For me it was not clear why i cannot unpause game on key press event by using "unpause game" block.

1 1 year, 4 months ago
Yuri - I've added a small blurb on that case. The answer is that pausing does not affect those events. You'll need to wrap them in an if-statement.

Roja - That no longer applies to Stencyl 3. In 2.0, Flixel's default binding for p is its internal pause menu.

0 1 year, 8 months ago
And how to pause a "do every N seconds event" it drops actors to scene. but pause do nothing to it. How i fix this??
0 1 year, 10 months ago
how to unpause:(

1 2 years, 3 months ago
for the example to pause u press space, but if u press "p", it will bring up the standard pause menu. Is there any way to get rid of the pause menu?
0 2 years, 9 months ago
I take a scene behavior to an actor~

0 3 years, 1 month ago
using the event1 code?can pause game,why can't unpause?
2 3 years, 1 month ago

Sign In to Comment