Overview
VOLTS provides you with a helper class that can manage events, snapshot signals, update SceneObjects, and do many more things!
You can only create ONE instance of this class across all your scripts, which you can access though the getInstance
function
World.getInstance
The getInstance function returns the current instance, or creates a new instance if none has been created before
If you are calling getInstance
for the first time, meaning you intend to create a new instance, you need to supply some parameters. After the first instance has been created, you can call getInstance
without any parameters
Parameters:
mode
: This parameter is required. It represents which 'mode' or behavior you want your code to follow, there are 3 modes to choose from. It's recommended thatDEV
is used while developing and iterating, and later switched toPRODUCTION
once you want to export/push to a device.DEV
: this mode has some additional checks and procedures, which are used to make Volts play nicer (around its bugs) with Spark AR StudioPRODUCTION
: this mode just runs your code as it is, no additional checks or workarounds, which don't matter on deviceNO_AUTO
: this mode is more advanced and is only recommended for scripts which try to extend theVoltsWorld
class
assets
: This parameter is optional. An object composed of key-value pairs, with the values being a Promise that resolves to some asseet in Spark AR Studiosnapshot
: This parameter is optional. An object composed of key-value pairs, with the values being a Signal of typeScalarSignal
,Vec2Signal
,VectorSignal
,Vec4Signal
,StringSignal
, orBoolSignal
. Which get snapshot-ed tonumber
,Vector
,string
, andboolean
(s)loadStates
: a State (or array of States) which are to be loaded by the time the World has loaded
Example using all parameters:
Last updated