Smooth, organized game UI for Unity, AI-ready. Build game UI from Addressable scenes on a state stack, with shared elements, built-in animations and an editor that generates the scripts, scenes and config for you. Free and open source (MIT).
翻譯準備中
正在載入完整 README。
檢視完整 README ↗A Unity UI framework that builds screens from Addressable scenes loaded additively and managed on a LIFO state stack. Elements receive runtime data through a single Populate(object context) contract, and an editor window generates the scripts, scenes and runtime config for you.
<Name>Root → Canvas → Root with the global canvas settings, and existing scenes can be validated and fixed in one click from the Elements tab (Global Canvas Settings live in the General tab)From the Unity Asset Store (coming soon): the listing isn't live yet. Once it is, add UI Framework to your assets, then install it from Window → Package Manager → My Assets. It is the same package as the git URL below, without the sample app.
From git: Package Manager → + → Add package from git URL…
https://github.com/dawaniyah-games/UiFramework.git?path=Packages/com.dawaniyahgames.uiframework
To pin a version, append #vX.Y.Z (see Releases). Or add it to Packages/manifest.json:
{
"dependencies": {
"com.dawaniyahgames.uiframework": "https://github.com/dawaniyah-games/UiFramework.git?path=Packages/com.dawaniyahgames.uiframework#v1.3.14"
}
}
Requirements: Unity 6 (6000.0 LTS) or newer, Addressables 2.2.2+ (installed as a dependency).
UiEditorConfig.MainMenuUiElement) → Create. This generates the script and scene. Build your UI under MainMenuUiElementRoot → Canvas → Root and pick show/hide animation presets in the list.MainMenuUiState), add its element scenes, and generate the state class.UiManager creates itself. Don't add it to a scene. It loads the generated UiConfig from Addressables (address UiConfig).
using UiFramework.Runtime.Manager;
using UnityEngine;
public class GameBootstrap : MonoBehaviour
{
private async void Start()
{
if (!UiManager.IsInitialized)
{
await UiManager.InitializeAsync();
}
await UiManager.ShowState<MainMenuUiState>();
}
}
using UiFramework.Core;
public class MainMenuUiElement : UiElement
{
public override void Populate(object context = null)
{
base.Populate(context);
MenuData data = context as MenuData;
if (data == null)
{
return;
}
// Configure the UI from data. May run more than once: keep it idempotent.
}
}
This repository's host project (Assets/) is a small mobile-game shell built only from framework features. It has an intro, four tabs (Home, Store, Leaderboard, Profile) under a shared TopBar and NavBar, and Settings, Reward and Confirm-purchase popups, with animation on every screen.
Assets/Scenes/Bootstrapper.unity and press Play (Addressables play mode Use Asset Database, or build Addressables content first). Use a portrait Game view (1080 x 1920).Then open Window → UI Framework → UI Setup Manager → Elements and change a screen's show / hide animation to see the difference. To choreograph a screen without code, add RevealOnShow, StaggeredReveal, FillBar, CountUpText or LoopMotion to its objects in the Inspector. DESIGN.md §14 lists the patterns the sample demonstrates.
| Call | Effect |
|---|---|
await UiManager.InitializeAsync() | Create the manager and load UiConfig (no-op if already initialized) |
await UiManager.ShowState<T>(context, additive) | Show the state whose key equals T's class name |
await UiManager.ShowStateByKey("Key", context, additive) | Show a state by its key |
await UiManager.ShowState<T>(context, transition: UiTransition.ShowWith(TweenPresets.ScaleKey)) | Optional: play a different show animation for this call only |
await UiManager.HideUI() | Pop and unload the top state |
await UiManager.HideUI(UiTransition.HideWith(TweenPresets.SlideRightKey)) | Optional: play a different hide animation for this call only |
UiManager.GetCurrentState() | Current (or currently loading) state |
UiManager.IsLastSceneActive<T>() | Whether T is the top state |
await UiManager.ResetUIAsync() | Hide and unload every state |
additive: false (default) replaces the stack. additive: true pushes on top, for modals and overlays.
以上為 README 的開頭部分。其餘內容請閱讀原文。 檢視完整 README ↗