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.

MemberMeaning
static DevCoreApp CurrentThe first enabled app (a game normally has one), or null
Everything of AppView and UIViewBelow

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.

MemberMeaning
string AppThe app's class name, "GameUI.App" by default. Setting it shows that app
Component RootThe mounted root component; cast it to your app's class. null until the app is loaded
event Action<AppView> AppLoadedRaised 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

MemberMeaning
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 : ComponentMounts a component, into the body by default; returns it
event Action<UIView> LoadedRaised when the page is ready
DocumentView ViewThe page: its document, styles, layout and input
Document DocumentShortcut for View.Document
FrameStatsThe last frame's timings

Where it draws

MemberMeaning
UIRenderMode RenderModeScreenOverlay, Camera, World, RenderTexture
TargetCameraThe camera it draws for; the main camera by default
UIScaleMode ScaleMode, ScaleConstant Pixel Size, Scale With Screen Size, Constant Physical Size
PanelSize, PixelsPerMeter, Pivot, DoubleSided, ResolutionWorld panels: size in meters, CSS pixels per meter, placement, texture pixels per CSS pixel
TargetTexture, TextureSize, InputColliderRender texture mode: where to draw, and the MeshCollider that maps hits to the page
RenderTexture TextureThe texture a World or Render Texture view draws into
ScreenToView, RayToView, ViewToScreenConversions between screen positions, rays and CSS pixels of the page

Queries

MemberMeaning
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.

MemberMeaning
IReadOnlyList<UIView> ActiveViewsThe views that are enabled
Q, Q<T>, Query<T>Queries over all views: HUD, menus, world panels
InputThe 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
ResourcesThe shared resources of all views: loader cache, font faces, images, atlases
LoaderThe shared resource loader
void InvalidateResources(Url url = null)Forgets one loaded file, or all of them
StatsTimings of the last frame over all views
event Action InputUpdateRaised 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.

MemberMeaning
DocumentThe DOM
InputThe page's DocumentInput: send pointer and key input from code
ScrollingScroll positions; ScrollIntoView
Animations, Styles, Layout, StatisticsThe engines behind the page, and their numbers
Mount, ComponentsMount 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, ElementsFromPointAs in a browser: see ElementFromPoint
SetSafeAreaInsets, SetKeyboardInsetsWhat env(safe-area-inset-*) returns
static DocumentView For(Document document)The view of a document