Skip to main content
Version: 2026.7
Still in testing

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.

UI panels

The SDK ships a set of UI Toolkit panels for environments: a text panel with buttons, a list, a check mark, a label, a choice, a HUD, and the host of toasts and popups. They are scene prefabs, in Packages > Virtuademy-SDK-Environments > Common > Prefabs > UI > Toolkit. They wear the Virtuademy theme, so they follow the tenant's colours, and every text takes a localization key.

They are the successors of the uGUI prefabs of Common > Prefabs > UI:

PanelReplacesUse it for
Virtuademy PanelDescriptionCanvas, DescriptionWarningCanvas, Wrong_DescriptionCanvas, WelcomePanel, ConfirmPopup, Default_CanvasA description, a hint, a warning, a right or wrong answer, a welcome, a confirmation
Virtuademy List PanelListItemCanvasA checklist: "find these four things"
Virtuademy Check MarkCheckCompletedA check mark or a cross at a point of the world
Virtuademy LabelHover_DescriptionCanvasA short text on what the pointer is on
Virtuademy Choice Panelnone"What do you do next?": one question, a column of options
Virtuademy HUDAnimatedScreenCanvasA counter with a progress bar, and a hint
Notification HostnoneThe toasts and popups of IUIApi

The uGUI prefabs still work and published environments keep them. For new work, use these.

How a panel works​

  1. Drag the prefab into your scene.
  2. Write its texts in the Inspector. Each text has a Key (a key of the Localization File) and a Text. With a key, the panel shows its translation and follows language changes; when the key is empty, or the file has no translation for it, it shows the text as written.
  3. Wire its events (the Events foldout) to the rest of your scene, for example On Primary to a task or to an object's method. A panel holds no logic of the step it belongs to.
  4. Show and hide it. Visible On Start says whether it shows when the scene starts; otherwise call its Show(). A hidden panel takes no clicks and no rays.

All of them can also be driven from a script, through IUIApi, and from a graph through the component's methods.

Where they are drawn​

PanelDesktop and WebGLMobileVR
Panel, List, ChoiceIn the world, where you place itIn the worldIn the world
Check Mark, LabelIn the worldIn the worldIn the world
HUD, Notification HostOver the screen, inside the safe frameOver the screen, inside the safe frameA panel floating in front of the player (see In VR)

World panels are objects of the scene, on layer 0: a wall in front of them hides them like any geometry, and the mouse, the finger and the VR ray click their buttons. Screen panels are drawn over the view, under the application's own UI Toolkit panels.

Sizes. In the world, one UI pixel is one millimetre. A Virtuademy Panel is 640, 960 or 1280 px wide (S, M and L, the classes vd-panel--s, --m, --l): the default M panel is 0.96 m wide, and its 28 px body text is 28 mm high. Place a panel where it is read from 1.2 to 2 m. On a screen the panels are laid out for a 1920 x 1080 reference and scaled to the real screen.

Only the controls are clickable. The surface, the texts and the icons of a panel let the click through: only its buttons (and a choice's options) catch it.

Virtuademy Panel​

Virtuademy Panel (Virtuademy > UI > Virtuademy Panel). An optional round icon, a title, a text and up to two buttons.

The prefab VirtuademyPanel comes with six variants, which differ only by their role, their texts and their buttons:

PrefabVariantDefault texts
VirtuademyPanelDefaultA description
VirtuademyPanel_HintHint"A tip for this step." and a button OK
VirtuademyPanel_WarningWarning"Something needs your attention." and OK
VirtuademyPanel_ErrorError"That is not the right choice." and Try again
VirtuademyPanel_SuccessSuccess"That is right." and Continue
VirtuademyPanel_WelcomeDefault"What you will do in this training." and Start
VirtuademyPanel_ConfirmDefault"Confirm your choice." with Back and Confirm

The Variant picks the colour of the accent bar and of the icon (the roles Info, Warning, Error and Success): Default, Hint, Warning, Error, Success. Show Icon draws the icon.

FieldWhat it does
Title, BodyThe texts
Primary ButtonThe button on the right, in the action colour. Empty text and key: no button
Secondary ButtonThe outlined button on the left. Empty: no button
Visible On StartShown when the scene starts
Hide On ButtonHide the panel when either button is pressed (on by default)

Events: On Shown, On Hidden, On Primary (Continue, Confirm, Start), On Secondary (Back, Cancel).

Methods: Show, Hide, SetTitle, SetText (each with the text as written, or with a key and a fallback), SetPrimaryLabel, SetSecondaryLabel, and the property Variant.

In VR the panel catches the ray only while it is shown and has a button: a panel with only a title and a text lets the ray through to what is behind it.

Virtuademy List Panel​

Virtuademy List Panel. A title and a list of items, each with a marker that fills when the item is done, and an optional accent on the current one. For a step such as "find the four hazards".

FieldWhat it does
TitleThe heading
ItemsThe rows: a text each, and whether it starts done
Current IndexThe row accented as the current one; -1 for none
Visible On StartShown when the scene starts

Events: On Item Done (with the row's index) and On All Done. Methods: Show, Hide, SetDone(index, done), MarkDone(index), SetCurrent(index), SetItems(texts) (texts as written, all not done), ResetItems().

On All Done is raised when marking a row done completes the list.

Virtuademy Check Mark​

Virtuademy Check Mark. A round check mark (right) or a cross (wrong) that pops in at a point of the world, for the answer to an action.

FieldWhat it does
State On StartHidden, Correct or Wrong
Auto Hide SecondsSeconds before it hides by itself; 0 keeps it shown

Events: On Shown Correct, On Shown Wrong, On Hidden. Methods: ShowCorrect, ShowWrong, ShowResult(correct), Hide.

It has no collider, so it never catches a click or a ray.

Virtuademy Label​

Virtuademy Label. A short text on a dark pill in the world. It is meant for what the pointer is on: show it from the hover events of an Interactable and hide it on hover exit.

FieldWhat it does
TextThe text
Visible On StartOff by default: call Show
Face CameraTurn to the user, upright, around the vertical axis (on by default)

Methods: Show, Hide, SetText. It has no collider.

Virtuademy Choice Panel​

Virtuademy Choice Panel. A question with a column of options. It is for branching ("What do you do next?") and for select-and-confirm steps. A scored question with right and wrong answers is the Quiz.

FieldWhat it does
Title, PromptThe question and an optional line under it
OptionsOne text per option
Confirm ChoiceOff: a press chooses. On: a press selects, and the confirm button chooses
Confirm LabelThe text of the confirm button
Hide On ChoiceHide the panel once an option is chosen (on by default)
Visible On StartShown when the scene starts

Events: On Option Selected (with the index, in confirm mode) and On Option Chosen (with the index). Methods: Show, Hide, SetOptions(texts), Confirm(); SelectedIndex is -1 until something is selected.

Virtuademy HUD​

Virtuademy HUD. A counter ("Found 2/5") with a progress bar, a hint box and a hint button. It stays on the screen, at the top right of the safe frame; in VR it floats at the lower right of the view.

FieldWhat it does
Counter LabelThe label left of the counter
Hint Button LabelThe text of the button; empty text and key: no button
Hint On RequestThe hint the button shows (a second press hides it). Empty: the button only raises On Hint Requested, and you show the hint yourself
Max Count, CountThe counter
Visible On StartShown when the scene starts

Events: On Hint Requested, On Count Changed (with the new value), On Completed (the count reached the maximum). Methods: Show, Hide (it slides in and out), SetMaxCount, UpdateCount, Increment, DisplayHint(text), HideHint, RequestHint (the same as pressing the button), SetHintOnRequest.

The prefab carries a Safe Frame set to Edges and an Overlay Panel Placement.

Notification Host​

Notification Host. It draws the toasts and the popup that scripts and graphs ask for. You do not need one in your scene: the application provides its own. Place the prefab only to restyle them. See Toasts and popups.

In VR​

The HUD and the Notification Host are overlays. With Overlay Panel Placement (on their prefabs), in VR each becomes a world panel in front of the player, placed when it is enabled:

OverlaySizePosition
Notification Host1.4 x 0.9 m1.4 m in front, 0.1 m below the eyes, centred
HUD0.52 x 0.38 m1.6 m in front, 0.55 m below the eyes, 0.9 m to the right

The panel is placed in front of the head when it appears and then goes with the player's body, not with the head: walking, teleporting and turning with the controller carry it along, and turning the head does not move it. The method RecentreNow() of the component brings it in front of the player again (call it from a UnityEvent or a graph). Its settings are on the component: Vr Size, Vr Distance, Vr Height Offset, Vr Side Offset, Vr Follow Head (off: it stays where it was placed) and Vr Hide While Help Open.

The panels let the ray through where nothing is shown. A world document gets a collider the size of the whole panel, and a controller ray stops at it, so the SDK turns the collider off whenever the panel has nothing to press:

  • the Notification Host catches the ray only while a popup is open (toasts take no clicks);
  • the HUD catches it only while it is shown with its hint button;
  • a Virtuademy Panel only while shown with a button; a list or a choice only while shown; the label and the check mark never.

While the application's tutorial (help) panel is open, Vr Hide While Help Open (on by default) hides the overlays and lets the ray through, because that panel is where the user must point. A script can read the same state: see IHelpApi.IsOpen.

A panel of yours can take the ray meant for the application's panels

The controller ray hits the collider of any panel that is shown. A world panel with a button that stands in front of the tablet, the tutorial or another panel of the application takes the ray meant for them. Keep your panels out of the way of where the user opens the tablet, and hide them while Help.IsOpen or Tablet.IsOpen are true.

From a script​

A script cannot reference the panel components (they belong to assemblies the security rules do not allow), so it drives them through their GameObject with IVirtuademyGameplay.Current.UI. Each call returns false when the object has no panel it applies to.

CallWhat it does
ShowPanel(go), HidePanel(go)Show or hide the panel on go
SetPanelText(go, title, text)Set the texts as written. A panel: title and body. A choice: title and prompt. A list: title. A label: the text. A null argument leaves that text alone
SetPanelVariant(go, variant)The variant of a Virtuademy Panel (EPanelVariant: Default, Hint, Warning, Error, Success)
SetHudCount(go, count, max = -1)The counter of a HUD; a negative max keeps the maximum
SetHudHint(go, hint)The hint of a HUD; empty hides it
SetListItemDone(go, index, done)Mark a row of a list done or not
ShowCheckResult(go, correct)The check mark or the cross
PanelButtonPressedEvent (GameObject panel, int index), for a button of any SDK panel of the scene. The index is 0 for the primary button, 1 for the secondary, the option's index on a choice panel, and 0 for the HUD's hint button

PanelButtonHandler is a type of the SDK: write a method with the same shape and subscribe it, with no delegate declaration of your own.

using UnityEngine;
using Virtuademy.Environments.ScriptingApi;

public class HazardCounter : MonoBehaviour
{
[SerializeField] private GameObject hud;
[SerializeField] private GameObject confirmPanel;

private int found;

private void Start()
{
if (!IVirtuademyGameplay.IsAvailable)
{
return;
}

IVirtuademyGameplay.Current.UI.PanelButtonPressed += OnPanelButton;
}

private void OnDestroy()
{
if (IVirtuademyGameplay.IsAvailable)
{
IVirtuademyGameplay.Current.UI.PanelButtonPressed -= OnPanelButton;
}
}

// Hook this to the On Interact of each hazard.
public void HazardFound()
{
found++;
IVirtuademyGameplay.Current.UI.SetHudCount(hud, found);
}

private void OnPanelButton(GameObject panel, int index)
{
if (panel == confirmPanel && index == 0)
{
IVirtuademyGameplay.Current.UI.ShowPanel(hud);
}
}
}

What not to do​

  • Do not put your logic in a panel. Its events say that something was pressed; the step that reacts is in the scene, a task or a graph.
  • Do not set a localized text from a script with SetPanelText if it must follow the language: it is shown as written. Use the Key field, or translate it again on LanguageChanged (see Texts and languages).
  • Do not colour a panel with a value. Use the theme's roles (see Theme), or the tenant's colours do not reach it.
  • Do not leave a world panel in front of what must be clicked. A panel with a button catches the click and the ray over its whole area.