ParelVRDocs
Player site

Scripting / Reference

UI

Types in the ParelVR.Volt.UI namespace.

VoltButton#

ParelVR.Volt.UI.VoltButton reference extends VoltComponent

A button. Wire its click to a behaviour's public method in the inspector.

VoltButton properties#

bool Interactable { get; set; }

Whether players can press the button.

VoltCanvas#

ParelVR.Volt.UI.VoltCanvas reference extends VoltComponent

A canvas in the world.

VoltCanvas properties#

bool Enabled { get; set; }

Whether the canvas is drawn.

VoltDialogs#

ParelVR.Volt.UI.VoltDialogs static

Messages and questions for the local player, shown by ParelVR's own interface so they work on desktop and in VR.

VoltDialogs properties#

static bool IsAvailable { get; }

True when the client can show notifications and dialogs.

VoltDialogs methods#

static int ShowDialog(string title, string message, string confirmText, string cancelText)

Asks the local player a yes/no question. Returns an id, or 0 when a dialog of this world is already open; the answer arrives as OnDialogResult(id, confirmed) on the calling script.

static void ShowNotification(string title, string text)

Shows a short message to the local player. At most one a second; extra ones are dropped.

VoltImage#

ParelVR.Volt.UI.VoltImage reference extends VoltComponent

A picture element.

VoltImage properties#

Color Color { get; set; }

Tint of the picture.

bool Enabled { get; set; }

Whether the picture is drawn.

float FillAmount { get; set; }

How much of a filled image is drawn, 0 to 1.

VoltTexture Texture { get; set; }

The texture a raw image shows, for example a render texture a camera draws into. A sprite image keeps its sprite.

VoltInputField#

ParelVR.Volt.UI.VoltInputField reference extends VoltComponent

A text box players can type into.

VoltInputField properties#

bool Interactable { get; set; }

Whether players can type into the box.

string Text { get; set; }

The text in the box.

VoltPanel#

ParelVR.Volt.UI.VoltPanel reference extends VoltComponent

A rectangle of the UI: the layout of anything on a canvas.

VoltPanel properties#

Vector2 AnchoredPosition { get; set; }

Position of the pivot relative to the anchors.

Vector2 Size { get; }

Width and height of the rectangle.

Vector2 SizeDelta { get; set; }

Size relative to the distance between the anchors.

VoltPanel methods#

void SetVisible(bool visible)

Shows or hides the rectangle and everything in it.

VoltScrollView#

ParelVR.Volt.UI.VoltScrollView reference extends VoltComponent

A scrolling area.

VoltScrollView properties#

VoltPanel Content { get; }

The rectangle that holds the scrolled content.

Vector2 NormalizedPosition { get; set; }

Scroll position: (0, 0) is the bottom left, (1, 1) the top right.

VoltSlider#

ParelVR.Volt.UI.VoltSlider reference extends VoltComponent

A slider.

VoltSlider properties#

bool Interactable { get; set; }

Whether players can move the slider.

float MaxValue { get; set; }

Highest value.

float MinValue { get; set; }

Lowest value.

float Value { get; set; }

Current value.

VoltSlider methods#

void SetValueWithoutNotify(float value)

Sets the value without raising the slider's change event.

VoltText#

ParelVR.Volt.UI.VoltText reference extends VoltComponent

A text element, legacy or TextMeshPro.

VoltText properties#

Color Color { get; set; }

Colour of the text.

float FontSize { get; set; }

Size of the text.

string Text { get; set; }

The text shown. Limited to 16,000 characters.

VoltToggle#

ParelVR.Volt.UI.VoltToggle reference extends VoltComponent

A checkbox.

VoltToggle properties#

bool Interactable { get; set; }

Whether players can change the box.

bool IsOn { get; set; }

Whether the box is ticked.

VoltToggle methods#

void SetIsOnWithoutNotify(bool value)

Sets the state without raising the toggle's change event.

VoltUI#

ParelVR.Volt.UI.VoltUI static

Helpers for world UI.

VoltUI methods#

static string ColorToHex(Color color)

Turns a colour into text such as "#FF8800FF", for rich text.

static void RebuildLayout(VoltPanel panel)

Redoes the layout of a rectangle and its children now instead of at the end of the frame.

VoltWorldMenu#

ParelVR.Volt.UI.VoltWorldMenu static

The world's own menu in ParelVR's main menu (a ParelVR World Menu component in the scene): its icon in the menu's top bar opens its pages, buttons, toggles, sliders and option switchers. Controls and pages are named by the id set on them. Values are the local player's own; a script that wants everyone to see a change sends it as a network event or keeps it in a synced field. A player using a control raises OnWorldMenuButton, OnWorldMenuToggle, OnWorldMenuSlider or OnWorldMenuOption on every script; changes made here raise nothing.

VoltWorldMenu properties#

static bool IsAvailable { get; }

True when the world has a menu.

VoltWorldMenu methods#

static int GetOption(string id)

The picked choice of an option switcher, from 0.

static float GetSlider(string id)

A slider's value.

static bool GetToggle(string id)

Whether a toggle is on.

static void Open(string pageId)

Opens ParelVR's menu on a page of the world's menu (empty: the page it was on).

static void SetDescription(string id, string text)

Changes the short line under a control's name.

static void SetInteractable(string id, bool interactable)

Lets the player use a control, or greys it out.

static void SetLabel(string id, string text)

Changes a control's name in the menu.

static void SetOption(string id, int index)

Picks a choice of an option switcher, from 0.

static void SetSlider(string id, float value)

Moves a slider (kept between its minimum and maximum).

static void SetToggle(string id, bool on)

Switches a toggle on or off (and what it switches without code).

static void SetVisible(string id, bool visible)

Shows or hides a control.