# 5. Menu and HUD Juice, and Pitfalls
Part of [[Tweening and UI Juice]]. Back: [[4. DOTween and PrimeTween Compared]].
> [!warning] Code not compiled in Unity
> The recipe assembles type-checked scripts from parts 2–3 with official USS rules. It has not been play-tested with a paused `Time.timeScale`.
## 5.1 A small recipe
On the pause stack you already have in [[Menus, Pause and Settings Flow]] / [[3. Main Menu and Screen Stack in UI Toolkit]]:
1. Put `MenuPanelTransitions` on the pause `PanelRenderer`. Assign `FightView`-style UXML with `#menu-panel` and the USS from part 3.
2. When pause begins, set `Time.timeScale = 0` as that series already does, then `SetOpen(true)`. If the first pause in a session has no animation, delay `SetOpen(true)` by one frame (official first-frame rule) or use `schedule.Execute`.
3. On Resume, `SetOpen(false)` and wait for `Closed` before you restore `timeScale` and hide the panel. If `Closed` does not arrive (transition did not run), restore `timeScale` on a `TweenRunner` unscaled fallback timer.
4. Gameplay hit-punches stay on `WorldJuice` (`unscaled: false`) so they freeze with the world.
HUD damage flash can be either a USS class on a health bar (`is-hit` changes `background-color` with a 100ms transition) or a `TweenRunner` float that you bind to a `ProgressBar`. Prefer USS if the bar is already a visual element; prefer the runner if you must run under a verified unscaled clock.
## 5.2 Symptom table
| Symptom | Check first |
|---|---|
| Pause menu does not animate | Official first-frame rule; you opened it on the panel's first `OnEnable`. Delay one frame. |
| `translate` / `left` transition does nothing | Official unit mismatch. Set `translate: 0px` or `left: 0px`, not a default `auto` or a `%` mixed with `px`. |
| Hover eases in but not out | Transition is only on `:hover`. Official note: put `transition-*` on the element itself. |
| `TransitionEndEvent` never fires | Official: it does not fire if the transition is removed before completion, or if no previous state existed. Also check `evt.target`. |
| Pause panel freezes in mid-slide | You drove it with `TweenRunner` and `unscaled: false` (or a third-party tween still using scaled time) while `Time.timeScale` is 0. Use `unscaled: true` or the official independent-update flag in part 4. |
| USS under pause is still frozen | Whether USS follows `timeScale` is **not verified**. Confirm, or use the runner. |
| Hit-punch keeps going during pause | `WorldJuice` was pointed at a runner call with `unscaled: true` by mistake. |
| Scale punch never returns to rest | You started a second `Play` without `Stop` on the previous id, or `onComplete` was overwritten. |
| GC spikes when many punches fire | New lambda every `Play`. Cache the delegate or use a method group. |
| Two libraries fight over the same transform | Pick one of `TweenRunner`, DOTween, PrimeTween per property (part 4). |
| `DOMove` / `Tween.PositionY` will not compile | Those packages are not in the project. Install the official versions in part 4, or stay on `TweenRunner`. |
## 5.3 What this series will not do
It will not animate camera authoring — that is [[Cinemachine 3]]. It will not replace Mecanim for character performances ([[Animation Advanced]]). It will not add DOTween or PrimeTween to the compiled samples.
Back to the hub: [[Tweening and UI Juice]].