Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ XR Studio

Runtime::Environment

  • Last UpdatedSep 17, 2025
  • 1 minute read

The Runtime::Environment class provides useful functionalities for flow control.

Code example

This is a code example for Runtime::Environment.

Runtime::Environment.Assert(a == 2, "a must be 2"); //throws an exception and displays ” a must be 2” if a!=2

Runtime::Environment.GetNodeName(this); //retrieves the name of the current instance of the class

double t=Runtime::Environment.GetTimeFromStartup(); //t=some time in seconds

Runtime::Environment.Print("hello " + 3); //[INFO][XRS] hello 3

Runtime::Environment.Print("time from start: "+Runtime::Environment.GetTimeFromStartup()); //[INFO][XRS] time from start: ###

Runtime::Environment.StartAsync(test()); //calls the method public async static void test(){}

Commands

The following table shows the static methods currently accessible from Runtime::Environment class.

Method 

Return type 

Parameters 

Description 

Assert 

 

bool condition, string message 

Checks for the condition, and if false, displays a message in the Log panel. 

GetDeltaTime

double

Returns the time elapsed since previous logic frame execution.

GetNodeName

string

var node

Returns the name of the ScriptObject instance passed as an argument. Argument node can be either Literal keywords or any var variable.

GetTimeFromStartup 

double 

 

Gets the time in seconds since the start of XR engine. It returns a double with nanoseconds of precision. 

MatchRegex

bool

string stringToCheck, string regex

Returns Regex(regex).IsMatch(stringToCheck)

Print 

 

type value 

Prints a new line in the Log Panel displaying the value. The input parameter is automatically cast to string and string concatenation is supported using + operator. New line starts with [INFO][XRS].  

StartAsync 

 

async function 

Start asynchronous function. For more information, see async keyword.

In This Topic
Related Links
TitleResults for “How to create a CRG?”Also Available in