This page has been translated automatically.
UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
Usage Examples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
Migration
Migrating to UNIGINE 2.0
C++ API Migration
Migrating from UNIGINE 2.0 to UNIGINE 2.1
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

engine Functions

This set of functions specifies the path to the Unigine engine and its basic parameters.

int engine.addPlugin (string name)

Loads a custom library dynamically in engine runtime.

Arguments

  • string name - Full name of the library without its extension.

Return value

1 if the plugin library was successfully loaded; otherwise, 0.

void engine.dialogError (string title)

Displays a dialog window with errors set using the error() function.

Arguments

  • string title - Title to be displayed in the error window.

void engine.dialogMessage (string title)

Displays a dialog window with the last message set using the message() function.

Arguments

  • string title - Title to be displayed in the message window.

void engine.error (string format, ... )

Adds a text describing an error to the list of errors.

Arguments

string engine.getAppPath ()

Returns a path to the binary executable file.

Return value

Path to the executable file.

string engine.getArg (int num)

Returns a command line argument by its number.

Arguments

  • int num - Argument number, counting from 0.

Return value

Argument string.

string engine.getCachePath ()

Returns a path where cache files will be stored.

Return value

Path to a directory for cache files.

Controls engine.getControls ()

Returns a Controls object that holds system settings of input controls.

Return value

Controls object used to handle input controls; usually, it is an instance of the ControlsApp class.

string engine.getDataPath ()

Returns a path to the root data directory. This value is defined by the data_path console variable.

Return value

Root data directory.

string engine.getError ()

Returns a list of all pending errors as a single string.

Return value

List of errors or an empty string if there are no errors.

Gui engine.getGui ()

Returns a system Gui associated with the engine and used to manipulate the user interface.

Return value

System Gui used to manipulate the user interface.

string engine.getHomePath ()

Returns a path to the user's home directory.

Return value

Path to the user's home directory.

float engine.getInterfaceTime ()

Returns an interface time value, that is required to render all GUI widgets.

Return value

Interface time value, milliseconds.

string engine.getMessage ()

Returns the last message from the list of messages.

Return value

Message or an empty string if there are no messages.

int engine.getNumArgs ()

Returns the number of command line arguments.

Return value

Number of command line arguments.

int engine.getNumPlugins ()

Returns the number of loaded plugins.

Return value

Number of plugins.

string engine.getPluginName (int num)

Returns the name of the loaded plugin by its index.

Arguments

  • int num - Plugin index.

Return value

Plugin name.

float engine.getRenderTime ()

Returns the time value, required to prepare all data to be rendered in the current frame and feed rendering commands from the CPU to the GPU. See the Profiler article for details.

Return value

Rendering time value, milliseconds.

string engine.getSavePath ()

Returns a path where a default configuration file, save files, and screenshots will be stored.

Return value

Path to a directory for save files, etc.

float engine.getTotalTime ()

Returns the total time that both rendering and calculating of the frame took (the duration of the main loop in the application execution sequence).

Return value

Total time value, milliseconds.

float engine.getUpdateTime ()

Returns the duration of the update phase, during which the objects are prepared for their collision response to be calculated.

Return value

The update phase duration value, milliseconds.

int engine.isMain ()

Returns a value indicating if the current thread is the main engine thread.

Return value

Returns 1 if the current thread is main; otherwise, 0.

void engine.message (string format, ... )

Adds a new message to the list of messages.

Arguments

Last update: 2017-07-03
Build: ()