API reference

API overview

The engine's API has two sides: what you write inside a .dcue component, and what game code calls from outside. This page maps both to their namespaces.

Where to look

You want toPage
Declare state, props, effects and lifecycle in a componentComponent script
Write markup: expressions, directives, blocksTemplate syntax
Show an app or a page, and reach it from a MonoBehaviourViews and UiSystem
Change elements, set styles without allocating, find things by nameDOM, styles and queries
Handle pointer and keyboard events; send input from codeEvents and input
Use signals and reactive collections directlyReactivity
Read and switch textsLocale
Register cameras, models, videos, materials, font packsUnity content and fonts

Namespaces

NamespaceMain types
DevCore.UiEngine.Unity.HostingDevCoreApp, DevCore3DView, AppView, UIView, UiSystem, UIRenderMode, UIScaleMode, FontFallbackSettings, UIStatsOverlay
DevCore.UiEngine.Unity.ElementsUnityElements
DevCore.UiEngine.ViewDocumentView, ViewResources, ClientRect, the GetBoundingClientRect and ElementFromPoint extensions
DevCore.UiEngine.DomDocument, Element, Node, Text, InlineStyle
DevCore.UiEngine.Dom.EventsEvent, EventType
DevCore.UiEngine.InputPointerEvent, KeyboardEvent, WheelEvent, FocusEvent, InputEvent, DocumentInput, PointerInput, NavigationDirection, the pointer-capture extensions
DevCore.UiEngine.Css.PropertiesCssPropertyId
DevCore.UiEngine.Css.ValuesCssUnit, Rgba
DevCore.UiEngine.ComponentsComponent, ComponentRegistry, ContextKey<T>
DevCore.UiEngine.ReactivityReactive, Signal<T>, StateList<T>, StateDictionary<K, V>, ReactiveScope
DevCore.UiEngine.LocalizationLocale, LocaleKey, LocaleTable, PluralRules

Your game's own components are in the namespace of their folder: GameUI for Assets/DevCoreUIEngine/App, GameUI.Components for its Components folder.

Assembly references

The engine is split into assemblies named after its namespaces. An assembly definition that holds .dcue files, or game code that calls the engine, references the assemblies it uses: for example DevCore.UiEngine.Input for PointerEvent, DevCore.UiEngine.View for ElementFromPoint, DevCore.UiEngine.Css for CssPropertyId, and DevCore.UiEngine.Localization wherever there are components.

Conventions

A complete example

HudController.cs
using DevCore.UiEngine.Css.Properties;
using DevCore.UiEngine.Css.Values;
using DevCore.UiEngine.Dom;
using DevCore.UiEngine.Unity.Hosting;
using UnityEngine;

public class HudController : MonoBehaviour
{
    Element marker;

    void Start()
    {
        var app = DevCoreApp.Current;
        marker = app.Q("player-marker");                 // look up once, keep it
    }

    void Update()
    {
        Vector2 p = Minimap.PositionOf(transform);       // your game's code
        marker.Style.Set(CssPropertyId.Translate, p.x, p.y, CssUnit.Px);   // no restyle, no layout, no paint
    }
}