This page has been translated automatically.
Video Tutorials
Interface
Essentials
Advanced
How To
Professional (SIM)
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Lighting
Sandworm
Using Editor Tools for Specific Tasks
Extending Editor Functionality
Built-in Node Types
Nodes
Objects
Effects
Decals
Light Sources
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
Materials and Shaders
Rebuilding the Engine Tools
GUI
Double Precision Coordinates
API
Containers
Common Functionality
Controls-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
Content Creation
Content Optimization
Materials
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials
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

Warning
The scope of applications for UnigineScript is limited to implementing materials-related logic (material expressions, scriptable materials, brush materials). Do not use UnigineScript as a language for application logic, please consider C#/C++ instead, as these APIs are the preferred ones. Availability of new Engine features in UnigineScript (beyond its scope of applications) is not guaranteed, as the current level of support assumes only fixing critical issues.

The Engine class is required for the engine initialization and executing the main loop of the program. Also, you can get the engine startup options through this class.

See Also#

Analogues of C++ runWorldFunction() methods are described in the engine.world class reference.

Analogues of C++ runEditorFunction() methods are described in the engine.editor class reference.

Analogues of C++ runSystemFunction() methods are described in the engine.system class reference.

Engine Class

Members


engine.getAppPath ( ) #

Returns the path to a directory where binary executable file is stored.

Return value

Path to a directory where binary executable file is stored.

engine.getArg ( int num ) #

Returns a command line argument by its index.

Arguments

  • int num - Index of the command line argument.

Return value

Command line argument.

engine.getCachePath ( ) #

Returns a path to a directory where cached files will be stored.

Return value

Path to the directory with cached files.

engine.getDataPath ( ) #

Returns a path to the -data_pathdirectory specified at the engine startup.

Return value

Path to the data directory.

engine.getLibraryModulePath ( ) #

Returns a path to the Engine's dynamic library file.

Return value

Path to the Engine's dynamic library file.

engine.getEditorCache ( ) #

Returns a path to the editor script cache file.

Return value

Path to the editor script cache.

engine.getEditorScript ( ) #

Returns a path to the editor script (provided by the -editor_scriptcommand line argument).

Return value

Path to the editor script.

engine.getExternDefine ( ) #

Returns the external definitions specified on the application start-up.

Return value

The list of external definitions.

void engine.setBackgroundUpdate ( int update ) #

Sets the value indicating whether the application window is updated when the window is hidden or out of focus (rendering frames in background). By default your UNIGINE application stops rendering frames and updating its main window, when it window goes out of focus (e.g. user switches to another window). Setting the background update mode enables constant rendering regardless of whether the Engine window is focused or in the background.

Arguments

  • int update - Engine window update mode: 1 for constantly repeating update cycle (i.e. the application is updated even if the window is hidden or out of focus); otherwise, 0.

int engine.isBackgroundUpdate ( ) #

Returns a value indicating whether the Engine window is updated when the window is hidden or out of focus.

Return value

1 if the update cycle is constantly repeated (i.e. the application is updated even if the window is hidden or out of focus); otherwise, 0.

string engine.getFeatures ( ) #

Returns the list of features (like OpenGL, Direct3D, Microprofile, Geodetic, etc.).

Return value

The list of features (like OpenGL, Direct3D, Microprofile, Geodetic, etc.).

static engine.getVersion ( ) #

Returns the Engine version info.

Return value

Engine version info.

engine.getArg ( int num ) #

Returns the command-line argument by its index.

Arguments

  • int num - Index of the argument

Return value

Command-line argument

int engine.getNumPluginPaths ( ) #

Returns the number of paths to directories with plugins specified via -plugin_pathcommand-line option.

Return value

Number of the specified paths to directories with plugins.

int engine.getNumPlugins ( ) #

Returns the number of loaded plugins.

Return value

Number of plugins.

engine.getPluginPath ( int num ) #

Returns a path to a plugin directory specified via -plugin_path.

Arguments

  • int num - Plugin path number in the row of the specified plugin paths.

Return value

Path to a plugin directory.

float engine.getPresentTime ( ) #

Returns the total time spent on waiting for the GPU after all calculations on the CPU are completed. See the Profiler article for details.

Return value

Time value, in milliseconds.

Engine::PRECISION engine.getPrecision ( ) #

Returns the Unigine Engine precision type.

Return value

Precision type.

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.

engine.getSavePath ( ) #

Returns a path to a directory where a default configuration file, saved files and screenshots will be stored.

Return value

Path to a directory with the default configuration file, saved files, etc.

engine.getSoundApp ( ) #

Returns the current sound API.

Return value

Sound API used.

engine.getSystemCache ( ) #

Returns a path to the system script cache.

Return value

Path to the system script cache.

engine.getSystemScript ( ) #

Returns a path to the system script.

Return value

Path to the system script.

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). Includes update, render, swap and wait GPU.

Return value

Total time value, milliseconds.

float engine.getTotalCPUTime ( ) #

Returns the total CPU time taken to perform calculations for the frame (the duration of the main loop in the application execution sequence). Includes update, render and swap.

Return value

Total CPU 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.

engine.getVideoApp ( ) #

Returns a graphics API used for rendering.

Return value

Graphics API used for rendering.

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, ... values ) #

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

Arguments

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

Adds a new message to the list of messages.

Arguments

void engine.startFps ( ) #

Starts the FPS counter if it was stopped. All function calls are placed into a stack, so the number of calls to this function should correspond to the number of calls to the stopFps() function.

void engine.stopFps ( ) #

Stops the FPS counter. This function should be called if application window is hidden or some heavy non-rendering tasks are processing. All function calls are placed into a stack, so the number of calls to this function should correspond to the number of calls to the startFps() function.

float engine.getFps ( ) #

Returns the current value of the Engine FPS counter.

Return value

Value of the Engine FPS counter.

float engine.getIFps ( ) #

Returns an inverse value of the Engine FPS counter.

Return value

Inverse value of the Engine FPS counter (1/FPS).

float engine.getStatisticsFpsMin ( ) #

Returns the minimum FPS counter value for the last 600 frames.

Return value

Minimum FPS counter value for the last 600 frames.

float engine.getStatisticsFpsAvg ( ) #

Returns the average FPS counter value for the last 600 frames.

Return value

Average FPS counter value for the last 600 frames.

float engine.getStatisticsFpsMax ( ) #

Returns the maximum FPS counter value for the last 600 frames.

Return value

Maximum FPS counter value for the last 600 frames.

int engine.getVideoContextFlags ( ) #

Returns the current video context flags.

Return value

A set of current video context flags as an integer value.

void engine.quit ( ) #

The Engine requests to exit the application.
Last update: 2023-01-11
Build: ()