Documentation Home
v1.22 v1.23
v1.22 v1.23

Parameters

Parameters are typed settings that your extension exposes to users: a speed, an on/off option, a choice in a list, a color. You declare them as Data Assets; SkyReal VR then gives you a ready-made UI, change events, and automatic saving of the values. The SkyReal VR navigation modes use them for their speed, camera height and similar options.

For global settings of your extension, see Configs.

How it works

Parameters overview
  • A parameter is a Data Asset of a parameter type. It holds the name, the default value, the limits and the current value.

  • A Parameter Manager groups the parameters of an object in slots. Each slot has a fixed Identifier that your Blueprint uses to find the parameter, whatever its display name.

  • The object that owns the manager (an Actor or a component of your extension) implements the Skr Parameter Manager Provider interface. It is the unit that is loaded and saved.

Parameter types

Create a Data Asset with one of these classes:

Class

Value

Specific properties

Skr Parameter Bool

On/off

Default Value

Skr Parameter Int, Float, Double

Number

Default Value, Min Value, Max Value

Skr Parameter Choice

One element of a list

Possible values, Default Index. Initialize From Enum fills the list from a Blueprint enum.

Skr Parameter Color

Color

Default Value

Skr Parameter String

Text

Default Value

Skr Parameter Vector, Vector2, Vector4

Vector

Default Value

All types share these properties:

Property

Description

Name

Label shown in the UI.

Category

Groups the parameters in the UI.

Tool Tip Text

Explains the parameter to the user.

Is Exposed To UI

Shows the parameter in the UI. Disable it for a value you only use in your logic.

Exposure Condition

Optional rule to show the parameter only in some cases (see below).

Is Transient

The value is never saved.

Is Shared

Every object that uses this parameter shares the same value. For example, one speed for several navigation modes.

Save Scope

User Relative Save: saved for the user, in the SkyReal VR user folder. Map Relative Save (default): saved with the simulation.

Parameter Widget Class

Optional widget used to display the parameter. When empty, the default widget of the type is used.

Add parameters to your Blueprint

  1. Create the parameter Data Assets in your extension, outside RegistrableAssets.

  2. Open your Actor or component Blueprint. In Class Settings, add the Skr Parameter Manager Provider interface.

  3. Add a variable of type Skr Parameter Manager. In its default value, add one Parameter Slot per parameter: an Identifier, the Parameter Type and the Data Asset.

  4. Implement the interface functions:

    • Get Parameter Manager: return your variable.

    • Get Id: return a unique and stable string, for example MyExtension.MyTool. It identifies the saved values: if it changes, the saved values are lost.

    • Is Transient (optional): return true to never save the values of this object.

  5. On Begin Play, call Initialize Parameter Manager Provider with self. It resets the parameters to their default values, loads the saved values, and saves them automatically when the level ends.

If several instances of your Blueprint use the same Data Assets, call Duplicate Parameters on the manager before Initialize Parameter Manager Provider. Each instance then has its own values. Shared parameters are not duplicated.

Read and react to values

  • Try Get Parameter By Slot Name returns the parameter of a slot. Set As Class to its type (for example Skr Parameter Float) to get a typed output, then call Get Value or Set Value.

  • Bind To Slot Value Changed By Slot Name calls your event each time the value of a slot changes, whoever changes it. You can bind before the slot exists.

  • Each parameter also has an On Value Changed event.

  • Reset All Parameters To Default Values resets every parameter that is not shared.

Display the parameters

Add the BP_SkrParametersBox widget (plugin SkrUtilities, folder Parameters) to your UMG Widget, then call Set From Parameter Manager Provider with your Blueprint. The box creates one widget per exposed parameter, grouped by category: checkbox, slider, list, color picker, text field or vector fields depending on the type.

Show a parameter only in some cases

  1. Create a Blueprint class that inherits from Skr Parameter Condition.

  2. Override Is Condition Met. Use the Related Parameter Manager input to read other parameters, for example to return the value of a Bool parameter.

  3. Select this class in the Exposure Condition of the parameter.

Saving

Values are saved in a SkrParameters.json file:

  • User Relative Save: in the SkyReal VR user configuration folder. The value follows the user from one simulation to another.

  • Map Relative Save: next to the simulation file. The value is saved and loaded with the simulation.

Saving happens when the level ends. To save at another moment, call Save All Parameter Manager Providers on the Skr Parameter Subsystem.

Common issues

  • Values are not restored: check that Initialize Parameter Manager Provider is called, that Get Id returns the same string at each launch, and that neither the parameter nor the provider is transient.

  • Two objects change each other's values: they use the same Data Assets without Duplicate Parameters, or the parameter is shared.

  • A parameter is missing from the UI: check Is Exposed To UI and its Exposure Condition.

  • Try Get Parameter By Slot Name fails: the identifier is wrong, or As Class doesn't match the type of the parameter.