The SDK of this version is still being tested, and these pages are being updated with it: names, menus and procedures may still change before the release. If you build content for a platform already in production, follow the documentation of that version — pick it from the version menu at the top right.
Theme
Every UI Toolkit panel of the SDK is drawn with one theme: the Virtuademy theme. It is a set of tokens, USS variables that start with --vd-, for colours, fonts, type sizes, radii and spacing. A panel never holds a colour of its own: it asks the theme for a role (surface, text, action…), so the application can restyle a whole environment by changing the colour of a role. The panels, the toasts and popups and the SDK's other UI Toolkit panels all read it.
The theme files are in Packages > Virtuademy-SDK-Environments > Common > Theme:
| File | What it is |
|---|---|
VirtuademyTheme.asset | The values: colours by role, type scale, the three Poppins weights, radii, spacing |
VirtuademyTokens.uss | The same values as USS variables. It is generated from the asset: do not edit it |
VirtuademyComponents.uss | The panel classes (vd-panel, vd-button--primary, vd-list…), all written with the variables |
Virtuademy.tss | The runtime theme of the SDK's panel settings: Unity's default controls, then the two sheets above |
Colour roles
There are twelve roles. The variable of a role is --vd-color- and the role name in lower case with dashes.
| Role | Variable | Default | Used for |
|---|---|---|---|
| Surface | --vd-color-surface | #12141A, 92% opaque | Panel background |
| Surface Raised | --vd-color-surface-raised | #242832 | What sits on a panel: a card, a list row, a field |
| Border | --vd-color-border | White, 12% opaque | Outlines and separators |
| Text | --vd-color-text | #FFFFFF | Body text |
| Text Secondary | --vd-color-text-secondary | #B8BCC6 | Captions, hints |
| Action | --vd-color-action | #006EF5 | Primary buttons, selection, progress: what the user acts on |
| On Action | --vd-color-on-action | #FFFFFF | Text and icons on the action colour |
| Success | --vd-color-success | #00C38A | Right answer, completed step |
| Warning | --vd-color-warning | #DB7F3C | Something needs attention, nothing went wrong |
| Error | --vd-color-error | #D14858 | Wrong answer, failed step |
| Info | --vd-color-info | #5AA9FF | Neutral information and hints |
| Scrim | --vd-color-scrim | Black, 60% opaque | The dimming layer behind a popup |
Type, radii and spacing
| Token | Values |
|---|---|
--vd-font-regular, --vd-font-semibold, --vd-font-bold | Poppins Regular, SemiBold and Bold, from the font files of the package |
--vd-font-size-caption, -body, -subtitle, -title, -display | 22, 28, 34, 44 and 60 px |
--vd-radius-s, -m, -l | 8, 16 and 28 px |
--vd-space-xs, -s, -m, -l, -xl | 4, 8, 16, 24 and 40 px |
--vd-border-width | 2 px |
--vd-motion-fade | 0.2 s, the fade of toasts and popups |
The panels use the Poppins files directly, so they show every glyph the font has. TextMesh Pro texts are another matter: see the known issue in SDK setup.
The panel settings
The package carries three panel settings (Common > Theme), all with the Virtuademy theme:
| Asset | Used by | What it does |
|---|---|---|
VirtuademyScreenPanelSettings | The panels drawn over the screen: the HUD, toasts and popups on desktop, WebGL and mobile | Screen overlay, scaled from a 1920 x 1080 reference (matching width and height equally), sorting order -1: it is drawn under the application's own UI Toolkit panels |
VirtuademyWorldPanelSettings | The panels that stand in the world, and the overlays in VR | World space, 1 px = 1 mm (1000 px per unit), with a collider the size of the panel for the controller ray and the mouse |
VirtuademyWorldDisplayPanelSettings | The label and the check mark | World space, 1 px = 1 mm, no collider: they never catch a ray or a click |
Tenant colours
The application knows the colours of the tenant that is running the environment. When it starts, it publishes them to the theme, and the panels of the SDK take them over, with no work from you. Today:
- The Action colour is the tenant's primary colour. The On Action colour is picked for contrast with it (dark text on a light colour, white on a dark one), unless the tenant sets one.
- The other roles keep the SDK value, unless the tenant's own theme defines that role.
- A role the application does not publish keeps the value of the table above, which is also what every panel shows in an authoring project played without the application.
A tenant whose brand colour is orange sees its primary buttons, progress bars and selection in orange, and the surfaces, text and status colours as the table says. For the Virtuademy tenant the primary colour is the SDK default, so nothing changes.
For this to work, a part of your own UI has to ask for a role, not for a colour: a colour you write yourself stays as you wrote it.
Using the theme in your own UI Toolkit panel
Everything below applies to a panel you build with UI Toolkit (a UXML file shown by a UI Document) in your own project. Your C# scripts cannot create or change UI Toolkit elements (the security rules do not allow them to reference it): your own UXML is meant for static layouts, driven by the SDK's components or by the UnityEvents of a component.
- In the UXML, give the top element the class
vd-root, and import the two sheets with<Style>lines. The easiest way is to copy them from any UXML of Common > Prefabs > UI > Toolkit (for exampleVirtuademyPanel.uxml): the first line isVirtuademyTokens.uss, the secondVirtuademyComponents.uss. - Build with the SDK classes:
vd-panel(withvd-panel--s,--mor--lfor a width of 640, 960 or 1280 px),vd-title,vd-subtitle,vd-body,vd-caption,vd-buttonwithvd-button--primary,--secondaryor--ghost,vd-list,vd-progress,vd-check,vd-hud,vd-label. - To colour an element by role, add a utility class:
vd-bg-<role>for the background,vd-text-<role>for the text,vd-border-<role>for the borders, with the role name in lower case and dashes (vd-bg-surface-raised,vd-text-text-secondary). - In your own USS, write colours and sizes only as
var(--vd-…). To restyle one panel, set a variable on that panel's root (.my-panel { --vd-color-surface: #000000; }): the variable changes for the panel and everything in it. - Add the Themed Document component (Add Component > Virtuademy > UI > Themed Document) to the object with the UI Document. It applies the tenant's colours when the panel is built, when it is rebuilt and whenever the palette changes.
A tenant colour is applied to an element that carries a role class (vd-bg-*, vd-text-*, vd-border-*) or one of the SDK's component classes that take a role (vd-panel, vd-button--primary and --secondary, vd-progress__fill, vd-check, vd-cross, the accent bars of the panel variants and of the toasts…), and only in a document that has the Themed Document component. A class you invent, coloured in your own USS with a variable, follows the SDK theme but not the tenant: put a role class on the element too. The tenant's colour is written on the element, over any style sheet.
Because the tenant's colour is written on the element, it hides a :hover background. The SDK's buttons grow a little on hover and shrink a little on press (and a choice option changes its border) instead of changing colour. Do the same in your own panel.
Colours outside UI Toolkit
- A uGUI graphic (an Image, a TextMesh Pro text): add the Theme Color Role component (Virtuademy > UI > Theme Color Role) and pick the role; the optional Alpha multiplies its opacity. The colour is written when the scene plays, so the Editor keeps the colour serialized on the graphic: use Apply theme colour now in the component's context menu to preview it. The SDK's own uGUI prefabs do not carry it: they keep the colours they always had.
- A material, a line, a light: ask the theme from a script or a graph.
IVirtuademyGameplay.Current.UI.GetThemeColor(role)returns the colour of a role now (the tenant's if published, the SDK's otherwise), andUI.ThemeChangedis raised when the application publishes or clears the palette. In a graph, use the Get Theme Color node (UI nodes).
using UnityEngine;
using Virtuademy.Environments.ScriptingApi;
using Virtuademy.Environments.ScriptingApi.UI;
public class ActionColouredLine : MonoBehaviour
{
[SerializeField] private LineRenderer line;
private void Start()
{
if (!IVirtuademyGameplay.IsAvailable)
{
return;
}
IVirtuademyGameplay.Current.UI.ThemeChanged += Apply;
Apply();
}
private void OnDestroy()
{
if (IVirtuademyGameplay.IsAvailable)
{
IVirtuademyGameplay.Current.UI.ThemeChanged -= Apply;
}
}
private void Apply()
{
Color action = IVirtuademyGameplay.Current.UI.GetThemeColor(EThemeRole.Action);
line.startColor = action;
line.endColor = action;
}
}
The older UI Toolkit panels
The SDK's earlier UI Toolkit panels (the button panel, the menu panel with its buttons, the toggles and the 360 buttons) read the theme too: their blue, their surface and the text on their buttons come from the tokens. An environment built with this version shows the Virtuademy blue #006EF5 where earlier versions drew #387AFF; environments published before keep their look. The hover of the video toggle button no longer darkens: it grows, like the other buttons.
The uGUI prefabs (Default_Canvas, DescriptionCanvas, ListItemCanvas and the others of Common > Prefabs > UI) are not themed. The panels are their successors.