Skip to content

Concepts

The terms the rest of the guide uses, in the order you meet them. Read it once before the feature pages, or come back when a term is unfamiliar. The Glossary defines each term in a sentence or two.

Diagram: an .rml document styled by .rcss sheets opens per local player on a UI.Layer layer; a view model gives its Field Notify fields to an element with :model, and on:click calls one of its BlueprintCallable functions

Documents and content roots

A document is an .rml file: HTML-like markup with a <head> and a <body>, styled by .rcss style sheets it links. Documents and sheets live in a content root, the Content folder of the project (/Game) or of a plugin in the project that can contain content (/MyPlugin), and code names them by package path, such as /Game/UI/Rml/Menu.rml. A document opens per local player, from C++, Blueprint or the console; the Quick start opens one, and Documents lists everything its head can declare.

Layers and input modes

Each document opens on a layer, a UI.Layer.* gameplay tag from <meta name="layer"> (default UI.Layer.Game). The layers stack in the order of the Layer Order setting; Documents has the default order and the rules.

<meta name="input-mode"> decides who gets input while the document is open:

Value Input
game (default) The game keeps the keys and the mouse; the document takes no keys. For HUDs and overlays.
menu CommonUI menu input: the document takes keys, gamepad and mouse, the game gets none.
all CommonUI input for both: the document and the game both take input.

A menu or all document needs the CommonUI input setup for Confirm and Back.

View models and sources

A view model is an Unreal MVVM object (UMVVMViewModelBase, made in C++ or Blueprint) that holds the data and functions of a screen; a document reads its data and calls its functions. The head declares each model with <viewmodel>: its name, its class, and one source that says where the instance comes from:

Source Where the instance comes from Sample
create The document makes its own when it opens. FieldBinding
context The GameInstance MVVM view model collection, by context name. SourceContext
resolver A C++ resolver class, configured by the declaration's other attributes. SourceResolver
manual Nothing; game code assigns it with SetViewModel. SourceManual
path An object property chain read from the player, such as GetOwningPlayer.SampleViewModel. SourcePath

settable lets game code replace the instance of any of these (sample SourceSettable), and preview="<file>.json" binds stand-in data for the editor (sample EditorPreview). View models has the rules per source.

Bindings

:model="<name>" on an element makes a model's fields readable inside it. Only Field Notify fields (see the Glossary) are exposed, and the document updates when the model broadcasts a change. A field shows with {{ Field }}, and attributes bind it to classes, styles, attributes and conditions, as in this excerpt of the FieldBinding sample:

FieldBinding.rml
        <p>Count: {{ fields.Count }}</p>
        <p>Progress: {{ fields.Progress | format(1) }}</p>
        <p>{{ fields.Message | to_upper }}</p>
        <p :if="fields.bEven">The count is even.</p>
        <p :if="!fields.bEven">The count is odd.</p>
        <div class="fb-badge" class:fb-odd="!fields.bEven">odd or even</div>

A document never writes a property; it calls a function that does. Data binding has the types, transforms and lists.

Events

on:<event> runs an expression when the element receives the event. call('model', 'Function', args...) calls a BlueprintCallable function of the model that name picks, one the document declares, callIf(condition, 'model', 'Function', args...) calls only when the condition holds, and stopPropagation() stops the event there. data-action is a document action handled by the plugin, not a view model call: close closes the document. Another excerpt of the same document:

FieldBinding.rml
            <button id="fb-add" class="fb-button" on:click="call('fields', 'Increment')">Add one</button>
            <button class="fb-button" data-action="close">Close</button>

See Events.

Components

A component is an .rml file whose root is <component>, with declared props and slots. A document imports it with <dc-import name="<package path>" prop="value"> (or by a name declared in the head with <link rel="component" href="<package path>" as="<name>"/>); props are static text or a bound {{ }} value, and the component's markup is expanded into the document when the document is compiled. See Components.

The update cycle

A change reaches the screen one update later: the plugin draws documents on its own thread, so a view model change shows in a later UI update, never inside the call that made it. A field set several times in one game frame arrives once, with its last value. call() and data-action run on the game thread's next tick, so what the function changes shows one update after the click.

Compiled files

The plugin runs compiled files, not the sources: each document X.rml compiles to X.rmlc and each style sheet X.rcss to X.rcssc, in the same folder. A compiled file is the parsed document or style sheet in a binary form, with its components expanded, and the list of files it was compiled from. A component has no compiled file of its own.

  • Editor: a document or style sheet is compiled when it opens and its compiled file is missing, was written by another plugin version, or one of the files it was compiled from has changed since. On save the editor compiles the changed files and reloads the open documents (Working with documents), and Validation compiles and checks documents without opening them. A game run with the editor's binaries compiles the same way when a document opens.
  • Cook: the cook compiles what it packages and ships the .rmlc and .rcssc files with the images and fonts they use; the .rml and .rcss sources are not shipped (Packaging).
  • Packaged build: reads only compiled files and never compiles. A document whose compiled file is missing does not open, and the error names it: no usable compiled file.

The compiled files are rebuilt from the sources, so they need not be in source control.

RmlUi

ArcRmlUI lays out and draws documents with RmlUi, an open-source UI library with HTML-like markup and CSS-like styling. ArcRmlUI extends it to behave more like a browser. This guide and CSS support are the reference for what a document can do. RmlUi's own documentation describes the library this plugin is built on; where it differs, this guide is right, and Coming from RmlUi lists the differences. Documents reach the game through view models and binding attributes, and code through the plugin's own API (C++ and Blueprint).