API reference
Views and UiSystem
A view is a MonoBehaviour that shows one page. DevCoreApp and DevCore3DView show a compiled app; UIView, their base, shows any page. UiSystem updates them all. Namespace: DevCore.UiEngine.Unity.Hosting.
DevCoreApp
The 2D screen UI. Render mode Screen Overlay or Camera.
| Member | Meaning |
|---|---|
static DevCoreApp Current | The first enabled app (a game normally has one), or null |
Everything of AppView and UIView | Below |
DevCore3DView
An app on a world panel or in a render texture (render modes World and Render Texture). It takes any app folder: drag its App.dcue onto the App field. Its members are those of AppView and UIView.
AppView
The abstract base of both.
| Member | Meaning |
|---|---|
string App | The app's class name, "GameUI.App" by default. Setting it shows that app |
Component Root | The mounted root component; cast it to your app's class. null until the app is loaded |
event Action<AppView> AppLoaded | Raised when the root component is mounted: its elements exist and can be queried |
void LoadApp() | Makes the page and mounts the app; again, when it was loaded before |
var app = DevCoreApp.Current;
var root = (GameUI.App)app.Root;
root.inventoryOpen = true;
var hud = app.Q<GameUI.Components.Hud>("hud");
UIView
Shows one page. Its inspector has Html (a .dcue file) or Url, the render mode, the scale mode, the camera and the panel settings.
Loading
| Member | Meaning |
|---|---|
void LoadHtml(string html, string baseUrl = null) | Shows a page from a string |
void LoadUrl(string url) | Shows a page from resources://, streaming://, file: or data: |
T Mount<T>(T component, Node target = null) where T : Component | Mounts a component, into the body by default; returns it |
event Action<UIView> Loaded | Raised when the page is ready |
DocumentView View | The page: its document, styles, layout and input |
Document Document | Shortcut for View.Document |
FrameStats | The last frame's timings |
Where it draws
| Member | Meaning |
|---|---|
UIRenderMode RenderMode | ScreenOverlay, Camera, World, RenderTexture |
TargetCamera | The camera it draws for; the main camera by default |
UIScaleMode ScaleMode, Scale | Constant Pixel Size, Scale With Screen Size, Constant Physical Size |
PanelSize, PixelsPerMeter, Pivot, DoubleSided, Resolution | World panels: size in meters, CSS pixels per meter, placement, texture pixels per CSS pixel |
TargetTexture, TextureSize, InputCollider | Render texture mode: where to draw, and the MeshCollider that maps hits to the page |
RenderTexture Texture | The texture a World or Render Texture view draws into |
ScreenToView, RayToView, ViewToScreen | Conversions between screen positions, rays and CSS pixels of the page |
Queries
| Member | Meaning |
|---|---|
Element Q(string name = null, string className = null) | The first element with that query:api name |
T Q<T>(string name = null, string className = null) | The first element or component of type T |
List<T> Query<T>(string name = null, string className = null) | All of them |
void Query<T>(List<T> results, string name = null, string className = null) | All of them, into your list: no allocation |
UiSystem
A static class. It updates every view once per frame after LateUpdate through a PlayerLoop hook; no Update method of yours is needed.
| Member | Meaning |
|---|---|
IReadOnlyList<UIView> ActiveViews | The views that are enabled |
Q, Q<T>, Query<T> | Queries over all views: HUD, menus, world panels |
Input | The input router. TryGetMouseView(out UIView view, out Vector2 position) tells whether the UI took the mouse; RayMove, RayDown, RayUp, RayWheel send XR rays to world panels |
Resources | The shared resources of all views: loader cache, font faces, images, atlases |
Loader | The shared resource loader |
void InvalidateResources(Url url = null) | Forgets one loaded file, or all of them |
Stats | Timings of the last frame over all views |
event Action InputUpdate | Raised when input is read each frame; a custom input backend sends its pointers and keys from here |
DocumentView
DevCore.UiEngine.View.DocumentView is the page itself, without Unity: a document with its style, layout, paint and input. UIView.View gives you the one of a view; you rarely make one yourself.
| Member | Meaning |
|---|---|
Document | The DOM |
Input | The page's DocumentInput: send pointer and key input from code |
Scrolling | Scroll positions; ScrollIntoView |
Animations, Styles, Layout, Statistics | The engines behind the page, and their numbers |
Mount, Components | Mount a component; the mounted roots |
UpdateLayout() | Brings style and layout up to date now |
HitTest(x, y) | The element at a point in the last frame as it is on screen; null over empty space. Cheap |
ElementFromPoint, ElementsFromPoint | As in a browser: see ElementFromPoint |
SetSafeAreaInsets, SetKeyboardInsets | What env(safe-area-inset-*) returns |
static DocumentView For(Document document) | The view of a document |