Files
FlowScope/Packages/com.flowscope.gamecore/Samples~/MainMenuP0/README.md
2026-06-04 20:16:28 +08:00

1.9 KiB

MainMenuP0 Package Sample

MainMenuP0 is the minimal FlowScope package sample. It demonstrates the recommended bootstrap path for a small Unity project without introducing a full game template.

What It Covers

  • Creating a root Container.
  • Registering config, resource, save, audio, UI, preload, and screen navigation services.
  • Registering MainMenuFeature with RegisterTransient.
  • Preloading MainMenuPanel through UIPreloadService.
  • Opening the main menu through UIScreenNavigator.
  • Updating PlayerData.Gold through R3-backed view data.
  • Saving data and releasing preloaded resources during ShutdownAsync.

How To Import

In a consuming Unity project, open Package Manager, select FlowScope Game Core, and import the MainMenuP0 sample.

Do not import this package sample into the FlowScope development project while Assets/FlowScope/Samples/MainMenuP0 is still present. The development project keeps the Assets-based sample as the source of truth for tests during P2 migration.

How To Run

After importing the sample, open:

Assets/Samples/FlowScope Game Core/<version>/MainMenuP0/Scenes/MainMenuP0.unity

Enter Play Mode. The scene should show the main menu panel, a Gold text, and an increment button.

Validation Points

  • The first startup shows default Gold.
  • Clicking the button increments Gold immediately.
  • ShutdownAsync writes the main-menu-player save.
  • Restarting restores the last saved Gold.
  • Shutdown releases preloaded UI resources.
  • Console has no unexpected Error or Exception.

Current Limits

  • The sample uses SampleResourceBackend instead of real Addressables assets.
  • Runtime fallback UI exists so the sample can still run if scene or prefab references are missing.
  • P2 package tests are not migrated yet; current automated tests still live under the FlowScope development project's Assets/FlowScope/Tests.