Skip to content

feat: VR help panels take the place of the menus - #548

Open
JaXt0r wants to merge 1 commit into
mainfrom
feat/improved-tutorial-menu-position
Open

JaXt0r wants to merge 1 commit into
mainfrom
feat/improved-tutorial-menu-position

Conversation

@JaXt0r

@JaXt0r JaXt0r commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

What

Clicking the Gothic logo in the VR menu no longer opens the help panels above the menu ring, where they made you look up. The panels now take the menus' places at eye level, facing the player:

  • status screen → VR controls
  • open Gothic menu → hero slots
  • quest log → help tabs

Clicking the logo again brings the Gothic menus back. Nothing new is added to the UI: the logo is the only toggle. The switch is instant, like Gothic's own menus. The main menu before loading a game swaps the same way.

Technical points:

  • New event GlobalEventDispatcher.GothicLogoClicked (argument: the logo). GothicLogoHandler (Core) raises it after the Marvin poke check instead of switching a VR GameObject itself.
  • TutorialHandler (VR) owns the help state:
    • It shows and hides its _panels, hides the _hiddenWhileShown menus (status screen and quest log in game, none in the main menu), and hides the open Gothic menu (MenuHandler.CurrentMenu, a new read-only getter).
    • The next MenuOpened (back button, or the menu reopening after a close) brings the menus back, so the menu always opens on the Gothic menus.
  • Tutorials.prefab: the panels move from y 5.2 with a -15° tilt to y 0 with no tilt; their sideways turn stays the same. The main menu's old placement overrides are removed.
  • Decision record: Docs/adr/2026-11-22-vr-help-panels-swap.md (replaces decision 3 of the 2026-11-13 record). Technical doc: Docs/vr-help-panels.md.

Why

Reading the help panels above the menu ring meant looking up for a long time: hard to read and straining the neck.

How to test manually

Setup for the steps checked below: VR Device Simulator (EnableVRDeviceSimulator = true), G1, SkipVideos; EnableMainMenu = true for the main menu steps.

  • In game, open the menu and click the Gothic logo: only the logo and the three help panels at eye level are visible (controls left, hero slots middle, help right).
  • Click the logo again: the status screen, main menu and quest log are back.
  • Open Options, click the logo, click again: Options is back.
  • Open Options, click the logo, press back: the main menu and the side menus are back, the panels are gone.
  • With the help shown, close the menu and open it again: it opens on the Gothic menus.
  • Click the logo for the Marvin pokes: the click that completes them doesn't toggle the help.
  • Main menu before loading a game: the logo swaps the main menu for the three panels, and clicking again or pressing back from a sub menu brings it back.
  • Headset: reading the panels is comfortable without looking up; the logo stays reachable above the middle panel.
  • G2: the same steps in game.

Test setup

Verified with the VR Device Simulator only (by an agent). The headset checks above are open for the author.

Known gaps / follow-ups

  • Help and Gothic menus can't be seen side by side any more.
  • Coming back from the help, the quest log shows its topic list again instead of the open quest.
  • Review findings left as follow-ups (see the response below): warnings for missing wiring, MenuOpened filtered to its own menu, MenuHandler as the only owner of the menu's visibility, and the VR Tutorials prefab living in the Core main menu scene.

AI usage

  • Claude proposed the swap, wrote the plan and the decision record, and had the plan reviewed.
  • A sub-agent built the code, made the prefab and scene changes through UnityMCP, and tested in play mode.
  • The human made the decisions: swap instead of stacking, the logo as the only toggle, an instant switch, always reopening on the menus, the quest log reset accepted, and the main menu swapping too.

AI review of 80d5c75

  • architecture-reviewer: fits with concerns, 4 findings (1 now, 3 later)
  • gothic-reviewer: approve, 0 bugs, 5 low notes
  • first review of this branch. Full reports in the comments.

Author's response

  • No fixes in this PR.
  • gothic 1, 2 (warnings for missing wiring): follow-up
  • gothic 3 (side menus always switched back on): disagree, nothing else switches them off
  • gothic 4 (comment on the reset path): disagree, the class comment covers it
  • gothic 5 (CurrentMenu getter): no change
  • architecture 6 (filter MenuOpened to its own MenuHandler): follow-up
  • architecture 7, 8 (MenuHandler.SetCurrentMenuHidden as the single owner): follow-up
  • architecture 9 (VR prefab in the Core main menu scene, existed before): follow-up
  • Main menu swap: signed off by the author (ADR decision 5)

🤖 Generated with Claude Code

https://claude.ai/code/session_013BrTJPpfcxHWh9DesVseUb

…aps the status screen, menu and quest log for the controls, hero slots and help at eye level (no more looking up), clicking it again brings the menus back; same in the main menu

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013BrTJPpfcxHWh9DesVseUb
@JaXt0r

JaXt0r commented Nov 22, 2026

Copy link
Copy Markdown
Contributor Author

First review of this branch (80d5c75).

architecture-reviewer: fits with concerns, 4 findings (1 now, 3 later)

Architecture review: origin/main...HEAD (VR help panels swap with the menu ring)

1. Verdict: fits with concerns. The coupling direction is right now: Core raises an event, VR listens, and the serialized VR reference on the Core GothicLogoHandler is gone. The concern is that TutorialHandler now switches menu GameObjects that MenuHandler owns, so the menus' visibility has two owners.

The mechanical layer check did not run. dotnet run --project .github/architecture-check fails because the local SDK is 8.0.427 and the project targets net9.0. The facts script shows no upward or lateral usings, no DI changes and no baseline additions.

2. Structural summary

  • New event GlobalEventDispatcher.GothicLogoClicked (UnityEvent<GameObject>, the argument is the logo). One raiser: GothicLogoHandler, a Core adapter, after the Marvin check. One listener: the VR adapter TutorialHandler. Principle 7: Core no longer knows the VR tutorial object.
  • MenuHandler (Core adapter) gained public GameObject CurrentMenu. It is the only new public Core member, read by one VR adapter via GetComponentInParent<MenuHandler>.
  • TutorialHandler (VR adapter, +86 lines) now owns the help state _isShown. It switches its _panels and _hiddenWhileShown, deactivates MenuHandler.CurrentMenu on show, and resets itself on the next MenuOpened. It has no per-frame work: one instance in game, one in the main menu.
  • Assets: Tutorials.prefab panels moved to y 0 with no tilt. The player prefab and MainMenu.unity wire _logo, _panels and _hiddenWhileShown, and the stale _tutorialHandler override is removed.
  • New ADR Docs/adr/2026-11-22-vr-help-panels-swap.md. It properly Replaces: decision 3 of the 2026-11-13 record, and the accepted record is not edited. Docs/vr-help-panels.md is updated with a "Swap" section.

3. Findings

[Minor, now] Assets/Gothic-VR/Scripts/Adapters/UI/Menus/TutorialHandler.cs:98 - OnMenuOpened reacts to every MenuOpened, from any MenuHandler (principle 7: event without a sender filter)
  cost: OnGothicLogoClicked filters by its own _logo because "main menu and player logo may coexist" (Docs/vr-help-panels.md), but OnMenuOpened does not filter. If both MenuHandlers are alive, a menu opened in one resets the other's help, and the two handlers follow different rules for the same coexistence case.
  step: in OnMenuOpened return early unless `_menuHandler != null && menu.transform.IsChildOf(_menuHandler.transform)`. One line, and both listeners then follow the "own menu only" rule.
[Minor, later] TutorialHandler.cs:82-92 + MenuHandler.cs:39 - TutorialHandler calls SetActive on a menu that MenuHandler instantiated and tracks (principle "every piece of state has one owner")
  cost: MenuHandler thinks _currentMenu is visible while it is inactive. Today OpenMenu -> CloseAllMenus + SetActive(true) heals it, and OnMenuOpened depends on exactly that ordering. Any future MenuHandler code that reads the current menu's activeSelf, or re-activates it (e.g. a settings refresh), breaks the swap silently. The public CurrentMenu getter also exists only for this VR caller and invites more outside callers.
  step: replace the getter with `MenuHandler.SetCurrentMenuHidden(bool isHidden)`, which also clears the hidden flag inside OpenMenu. TutorialHandler then calls it on show and hide and drops _hiddenMenu. MenuHandler stays the only owner of menu visibility, and the "first MenuOpened before Awake" ordering problem no longer matters.
[Minor, later] TutorialHandler.cs:46-48 - hidden temporal coupling (a known debt of the platform prefabs)
  cost: the comment explains the order (MenuHandler activates first, so CurrentMenu is asked on click), which is good. But correctness also depends on the Tutorials root staying active and on Awake running before the first logo click. Awake runs only if the root is active once, and MenuHandler's subtree activates lazily.
  step: none now. If the SetCurrentMenuHidden step above is done, this coupling goes away with it.
[Minor, later] Assets/Gothic-Core/Scenes/MainMenu.unity:827 - a Core scene holds a VR prefab instance (Tutorials.prefab, guid a0af29... in Gothic-VR) (Unity assets rule on Core assets referencing VR guids)
  cost: the instance existed before this branch; the change only adds an override (_logo). It is not new debt, but more wiring now sits on a Core->VR asset dependency, so Flat or a future non-VR main menu has to carry or strip it.
  step: follow-up issue: let the VR player or VR bootstrap spawn Tutorials into the main menu's MenuHandler, instead of keeping it in the Core scene.

No magic-number findings: the only numbers are prefab values. Performance: no new Update, no per-frame or world-size work, and no rendering change beyond moving existing panels.

4. Where to look

  • /home/jaxt0r/Gothic-workspace/Gothic-Unity/Assets/Gothic-VR/Scripts/Adapters/UI/Menus/TutorialHandler.cs: the swap state machine; check it against the cases in the ADR's Consequences.
  • /home/jaxt0r/Gothic-workspace/Gothic-Unity/Assets/Gothic-Core/Scripts/Adapters/UI/Menus/MenuHandler.cs, lines 39-41 and 124-187: the new getter, and the OnEnable -> OpenMenu -> CloseAllMenus path the reset depends on.
  • /home/jaxt0r/Gothic-workspace/Gothic-Unity/Docs/adr/2026-11-22-vr-help-panels-swap.md
  • Safe to skim: GothicLogoHandler.cs, GlobalEventDispatcher.cs (3 lines), Docs/vr-help-panels.md, and the prefab/scene diffs (field wiring and transform values).

5. Questions for the author

  • Can the main menu MenuHandler and the player MenuHandler both be alive (e.g. the main menu opened in game)? If never, the first finding is moot, but then the _logo filter's justification in the doc should change too.
  • Why a public getter rather than a hide/show method on MenuHandler? Was keeping MenuHandler unaware of the help panels intended?
  • The ADR decides that the main menu swaps too, while the plan's human decision was "main menu scene unchanged". Has the human signed off on the change (it is decision 5 in the ADR)?
gothic-reviewer: approve, 0 bugs, 5 low notes

Verdict: approve, with a few small notes. I found no blocking bugs. I only read the C# diff and MenuHandler. I did not open the prefab or scene YAML.

Bugs

  • None found.

Risks and nits (low)

  • Assets/Gothic-VR/Scripts/Adapters/UI/Menus/TutorialHandler.cs, OnGothicLogoClicked: if _logo is unset in a prefab or scene, the click is silently dropped (logo != _logo). The help then never shows and nothing is logged. Add a one-shot Logger.LogWarning(..., LogCat.Ui) in Awake when _logo == null or _panels is empty. Check the wiring in VR - Player XRI.prefab, Tutorials.prefab and MainMenu.unity by hand. GothicLogoHandler lost its _tutorialHandler field, so any scene or prefab still referencing it holds a stale serialized value.
  • TutorialHandler.cs: if GetComponentInParent<MenuHandler>(true) returns null, the open menu is never hidden and no log says so. Add a warning for that case too.
  • TutorialHandler.cs, hide path: it always sets every entry of _hiddenWhileShown to active. If one of them (for example the quest log) was inactive before the help opened, it comes back visible. This is fine if both are always active in game, but please confirm.
  • TutorialHandler.cs: if MenuHandler is closed through ToggleVisibility while the help is shown, _isShown stays true until the next OnEnable. That path calls OpenMenu, which raises MenuOpened and resets the state. This is correct but depends on that call chain, so add a comment.
  • MenuHandler.CurrentMenu is a new public property on an adapter that exposes a GameObject. It is acceptable.
  • Style looks fine. I saw no 120-column or naming problems in the C#.

Save/load, DI, config, wiki

  • No new runtime state, so nothing is saved or lost on load.
  • No new service registrations.
  • The new GlobalEventDispatcher.GothicLogoClicked listener is added in Awake and removed in OnDestroy, so there is no leak.
  • No new DeveloperConfig or ini keys, so no wiki follow-up is needed.
  • The ADR and Docs/vr-help-panels.md are updated.

Test manually in game

  1. Click the logo. The status screen, open menu and quest log hide, and the three panels show at eye level. Click again and everything returns, including the same open submenu.
  2. With the help shown, press back inside a submenu. The menu should return and the help should hide.
  3. With the help shown, close the menu and reopen it. It should open on the Gothic menus, not the help.
  4. Click the logo five times to trigger Marvin mode. The completing click must not toggle the help.
  5. Repeat in the main menu scene before loading a game (empty _hiddenWhileShown).
  6. Check that the quest log and status menus keep their prior active state after the help hides.
  7. Load a save and open the menu, and check that nothing stays hidden.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant