Validation¶
The validator compiles RML documents and RCSS style sheets and checks them against the project: view model classes, fields and functions, images, fonts, localization keys and input mappings. It finds in the editor what would otherwise show up as a log line when a document opens. A run needs the editor.
Run it¶
Content Browser. Select documents, style sheets or folders, and choose Validate RML in the context menu. A
notification shows the summary line, ArcRmlValidate: N files, 0 errors, 0 warnings. Its Show Message Log link (a
button when the run has errors) opens the Message Log window on the page Validate of the ArcRmlUI log. A run without problems has only the
summary line on that page; every other line is a diagnostic.
Console. In the editor, open the console and type:
ArcRml.Validate <Path> [<Path> ...]
A path is a file or a folder on disk, relative to the project folder, and must be under a content root. The result goes to the same Message Log page.
Commandlet. For a build machine. UnrealEditor-Cmd.exe is in the Engine/Binaries/Win64 folder of your Unreal Engine
install:
UnrealEditor-Cmd.exe "<Project>.uproject" -run=ArcRmlValidate -Paths="<Path>;<Path>" -WarningsAsErrors -json="<File>"
| Argument | Effect |
|---|---|
-Paths= |
Disk paths separated by ;, relative to the folder you run the command from, not the project folder. Without it the whole tree of every content root is validated. A path under no content root fails the run. |
-WarningsAsErrors |
A warning also fails the run. |
-json="<File>" |
Also writes the result as JSON: a summary of files, errors and warnings, the roots, and per diagnostic file, line, severity, code and message. |
Each diagnostic prints as <file>(<line>): <severity> <kind>: <message>, followed by a summary line
ArcRmlValidate: N files, N errors, N warnings. For example:
C:/MyProject/Content/UI/Rml/Menu.rml(12): error unknown-field: 'Helth' on model 'player' reads 'Helth', which 'PlayerViewModel' does not have
The exit code is 0, or 2 when there is an error, a warning with -WarningsAsErrors, a path under no content root, or a
check that did not run.
What it reports¶
Every diagnostic has a severity (error or warning) and a kind. The kinds a project meets most:
| Kind | Meaning |
|---|---|
unknown-field |
A binding reads a field the declared view model does not have. |
read-only-field |
A :value, :checked or event assignment writes a field Blueprint cannot write (BlueprintReadOnly, a getter, not Blueprint-visible); the game refuses the write (warning). |
unknown-function, call-arity |
call() names a function the model does not have, or passes the wrong number of arguments. |
invalid-value |
A call('model', 'Fn', ...) argument does not fit its parameter: a string for a number, a number for a bool and so on (below). |
view-model-path |
A path source cannot work; see below. |
unknown-class, view-model-create |
A <viewmodel class> does not load, or is abstract and cannot be created. |
unknown-resolver, unknown-resolver-property |
A resolver class is unknown, or an attribute names no property of it. |
head |
A <meta> or <viewmodel> in <head> is invalid. |
input-mapping |
An input-mapping does not load as an Input Mapping Context, or a menu document has no key on the Back action; a hotkey or <kbd action> names no UI action (below). |
asset-reference |
A <kbd action> or hotkey path is not the package path of an Input Action. |
missing-image, missing-font, unknown-font-family |
An image or font file is not found under a content root, or a font family has no @font-face. |
missing-document |
An open: target is not an RML document. |
missing-loc-key |
A localization key has no entry in its string table. |
structural-conflict |
For example :if and :for on one element, or a data-action other than close and open:<package path> without a :model on <body>. |
undefined-variable, duplicate-id |
An RCSS variable is used and never defined; two elements share an id. |
component |
A dc-import component problem. |
data-expression |
A data expression does not parse (warning). |
Other kinds come from the RCSS and RML compile (unknown property, invalid value, invalid selector, XML syntax, and similar), and from converting HTML into RML. A CSS declaration the engine drops is one of them, with the warning "unknown property" or "invalid value"; CSS support lists what is dropped.
view-model-path¶
A path source reads the view model through a chain of properties, such as GetOwningPlayer.SampleViewModel
(View models). The validator follows the chain with the types it can see, starting at
UUserWidget. When UUserWidget lacks the first segment and a Document Widget in a Widget Blueprint shows the
document, it starts again at that Widget Blueprint's class, so a path into a property of your widget gets no report. It
reports:
- A warning for a segment the visible type lacks. The live object may be a subclass that has it, so the check stops
there and the model can still resolve at run time. The SourcePath sample gets this warning on
SampleViewModel:GetOwningPlayerreturnsAPlayerController, which has noSampleViewModel, and the model resolves when the game runs. - An error for a segment that is not readable or not an object, and for a last type unrelated to the declared class.
A misspelled segment gets the same warning and never resolves, with no other message, so read the segment name in the warning.
Call arguments¶
The validator types each argument of a call('model', 'Fn', ...) or callIf and checks it against the parameter of Fn. A literal has its own type; a
model field has the type of its property; ev.value is a number on <input type="range"> and a string on other inputs; an expression, an alias or
a loop item is not typed and always fits. A number fits any numeric parameter (int and float both ways), a string fits a string, name or text parameter, and
a bool fits only a bool. A misfit is an error that names the argument, its type, the parameter and its type: "... passes 'abc' (string) to parameter 'Amount' (int32) of 'Heal', which does not fit it". The runtime still converts leniently, so a misfit
the check cannot see does not break a game; the editor's argument rows and function list use the same rule.
Input actions¶
The validator reads the value of data-hotkey, data-hotkey-focus, data-hotkey-cycle, data-drag-action and <kbd action> unless it contains {{ }}.
The UI actions it checks against are the actions of the input mapping contexts of the document, or of its frame when it is a tab (Input and gamepad).
| Value | Report |
|---|---|
A path (starts with /) that is no Input Action package path |
Error asset-reference. |
| A path of an Input Action that is no UI action of those contexts | Warning input-mapping. |
| A bare name no UI action has | Warning input-mapping. |
| A bare name that two UI actions share | Warning input-mapping that lists the paths; name one by its path. |
- For a
<kbd action>, the Confirm and Back actions of the project's Common Input settings also count, andconfirm,back,navigate,stepLeftandstepRightare not checked. - A read of
ArcKeys.<action name>is adata-expressionwarning, "ArcKeys.is deprecated: use <kbd action=\" \"/>", which names the path when one action has that name. ArcKeys.confirm,back,navigate,stepLeft,stepRightandschemeget none.