← Yop2D

How to make a pause menu?

Beginner guide · no code

Français · English · Español · Deutsch · Italiano · Português · Русский · 中文 · 日本語 · العربية

ℹ️ For Yop2D Next, the new 2D + 3D version of Yop2D (coming soon). Button and node names are those of Yop2D Next.

🔍 How do I…? All short recipes, with a search

A pause button that freezes the whole game, and a Resume button that appears during the pause. Both buttons go in a HUD: a scene laid over the game.

You need:

Step 1: the HUD scene

  1. Left panel, Scene tab, SCENES section: tap New scene, choose 2D scene and call it HUD.

Step 2: the two buttons

  1. Tap Object → Interactive → Button with text.
  2. Name it pause and type II in its Text line.
  3. Tap Object → Interactive → Button with text.
  4. Name it reprendre, type Resume in its Text line, and untick Visible in the game in the Inspector: it is hidden at the start.

Step 3: the HUD's nodes

  1. Open the Blueprint.
  2. On Object Click: Object pause → Pause the game → Visibility: Object reprendre, Visible (yes / no) Yes
  3. On Object Click: Object reprendre → Resume the game → Visibility: Object reprendre, Visible (yes / no) No

Step 4: open the HUD

  1. Tap the first scene in the list (the game's) and open its Blueprint.
  2. On Start → Open a HUD: Scene HUD

The nodes

On Object Clickpause
→
Pause the game
→
Visibilityreprendre · Yes
On Object Clickreprendre
→
Resume the game
→
Visibilityreprendre · No
On Start
→
Open a HUDHUD

Try it

Tap Play: the II button is at the top. Tap it: everything stops and Resume appears. Tap Resume: the game goes on.

⚠️ The buttons must be in the HUD: during the pause, the game scene no longer reacts, but the HUD keeps going.