This repository is a Unity sample project for building a desktop-OS-style window UI using only UGUI.
- Unity version:
6000.2.6f2or newer. - Main sample scene:
Assets/UGUIWindowSample/Scenes/UGUIWindowSampleScene.unity. - Core code lives under
Assets/UGUIWindowSample/Scripts/. - Window prefabs are loaded by convention from
Assets/Resources/Windows/{ClassName}.prefab. - Public-facing documentation starts at
README.mdanddocs/Manual.md.
Read these before changing behavior:
docs/manual/02-concepts.mdfor architecture, pooling, z-order, and DPI.docs/manual/03-creating-windows.mdfor creating custom windows and prefab naming.docs/manual/06-events-lifecycle.mdfor open, close, focus, and minimize events.docs/manual/07-samples.mdfor the desktop sample scene.docs/manual/08-api-reference.mdfor public APIs.docs/ClassDiagram.mdanddocs/class-diagram/*.mdfor class relationships.
UGUIWindowManageris the singleton entry point for window creation, pooling, z-order, DPI scaling, and ESC handling.UGUIWindowis the controller for each window. It owns the window mode and exposes:OnOpenWindowOnCloseWindowOnFocusWindowOnMinimizeWindow
UGUIWindowViewowns visual state such as header, border, buttons, fade, and maximized/restored layout.UGUIWindowStatestores position, size, anchors, and flags for restore behavior.- The sample desktop layer is in
Assets/UGUIWindowSample/Scripts/Sample/.
- Prefer existing patterns over new abstractions.
- Keep base window-system changes small and reusable.
- Put demo-only behavior in the
Samplefolder unless the feature belongs to the framework. - When overriding
UGUIWindow.AwakeorUGUIWindow.OnEnable, callbasefirst. - Use
UGUIWindowLogfor project logs instead of rawDebug.Login framework code. - Preserve object pooling behavior unless the task explicitly changes it.
- For features that observe window state, prefer subscribing to existing window events instead of polling.
- Avoid editing Unity prefab or scene YAML by hand unless the change is small, deliberate, and easy to verify.
- Keep
.metafiles with their assets. - Use forward slashes in Unity asset paths.
- Do not rename prefab/class pairs casually; window loading depends on class-name-to-prefab-name matching.
- If creating a new window class, add the matching prefab under
Assets/Resources/Windows/. - If changing serialized fields, consider whether existing prefabs need their references assigned in Unity.
- If Unity MCP/editor tools are available, use them to check compilation after C# changes.
- At minimum, inspect changed C# files and run repository searches for broken references.
- For UI work, verify the sample scene still covers:
- create/open
- focus/z-order
- minimize/restore
- close/pooling
- DPI changes
UGUIDesktopgathers childUGUIIconcomponents and spawns a few demo windows onStart.UGUIIconopens a window by resolvingUGUIWindow.{targetClassName}on double click.UGUIMenuopens the settings window and can quit the app.UGUIApplicationSettingapplies resolution, fullscreen mode, framerate, and DPI changes.