This page has been translated automatically.
Video Tutorials
Interface
Essentials
Advanced
How To
Rendering
Professional (SIM)
UnigineEditor
Interface Overview
Assets Workflow
Version Control
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
Animations-Related Classes
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
VR-Related Classes
Content Creation
Content Optimization
Materials
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials

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

static bool isInitialized() const#

Returns the current value indicating whether the engine is initialized.

Return value

true if the Engine is initialized; otherwise false.

static getAppPath() const#

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

Return value

Current path to a directory where binary executable file is stored.

static getDataPath() const#

Returns the current path to the data directory.

Return value

Current path to the data directory.

static getHomePath() const#

Returns the current path to the user's home directory.

Return value

Current path to the user's home directory.

static getSavePath() const#

Returns the current path to a directory with the default configuration file, saved files, etc.

Return value

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

static getCachePath() const#

Returns the current path to the directory with cached files.

Return value

Current path to the directory with cached files.

static int getNumPluginPaths() const#

Returns the current number of the specified paths to directories with plugins.

Return value

Current number of the specified paths to directories with plugins.

static getSystemScript() const#

Returns the current path to the system script.

Return value

Current path to the system script.

static getSystemCache() const#

Returns the current path to the system script cache.

Return value

Current path to the system script cache.

static getEditorCache() const#

Returns the current path to the editor script cache.

Return value

Current path to the editor script cache.

static getVideoApp() const#

Returns the current graphics API used for rendering.

Return value

Current graphics API used for rendering.

static getSoundApp() const#

Returns the current sound API used.

Return value

Current sound API used.

static getExternDefine() const#

Returns the current list of external definitions specified on the application start-up.

Return value

Current list of external definitions.

static getFeatures() const#

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

Return value

Current list of features like OpenGL, Direct3D, Microprofile, Geodetic, etc.

static getVersion() const#

Returns the current engine version info.

Return value

Current engine version info.

static void setBackgroundUpdate ( Engine.BACKGROUND_UPDATE update ) #

Sets a new 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 application window is focused or in the background.

Arguments

  • Engine.BACKGROUND_UPDATE update - The value indicating whether the application window is updated when the window is hidden or out of focus (rendering frames in background).

static Engine.BACKGROUND_UPDATE getBackgroundUpdate() const#

Returns the current 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 application window is focused or in the background.

Return value

Current value indicating whether the application window is updated when the window is hidden or out of focus (rendering frames in background).

static isActive() const#

Returns the current active state of the Engine.

Return value

Current the engine is active

static isFocus() const#

Returns the current value showing if any of the Engine windows is in focus.

Return value

Current the Engine window is focused

static isQuit() const#

Returns the current quitting flag on engine quit.

Return value

Current the engine is quitting

static float getTotalTime() const#

Returns the current total time (in milliseconds) 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

Current total time value, in milliseconds.

static float getTotalCPUTime() const#

Returns the current total CPU time (in milliseconds) 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

Current total CPU time value, in milliseconds.

static float getUpdateTime() const#

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

Return value

Current update phase duration value, in milliseconds.

static float getRenderTime() const#

Returns the current time (in milliseconds) 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

Current rendering time value, in milliseconds.

static float getPresentTime() const#

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

Return value

Current time value, in milliseconds.

static float getInterfaceTime() const#

Returns the current total accumulative time (in milliseconds) spent on rendering GUI widgets.

Return value

Current time value, in milliseconds.

static int64_t getFrame() const#

Returns the current number of the current engine frame.

Return value

Current engine frame number.

static float getFps() const#

Returns the current value of the Engine FPS counter.

Return value

Current value of the Engine FPS counter.

static float getIFps() const#

Returns the current inverse value of the Engine FPS counter (1/FPS).

Return value

Current inverse value of the Engine FPS counter (1/FPS).

static float getStatisticsFpsMin() const#

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

Return value

Current minimum FPS counter value for the last 600 frames.

static float getStatisticsFpsAvg() const#

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

Return value

Current average FPS counter value for the last 600 frames.

static float getStatisticsFpsMax() const#

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

Return value

Current maximum FPS counter value for the last 600 frames.

static isMainThread() const#

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

Return value

Current the current thread is main

static Player getMainPlayer() const#

Returns the current main player.

Return value

Current main player.

static isEvaluation() const#

Returns the current value indicating if the running version of the Engine is for evaluation only.

Return value

Current the evaluation version of the Engine is used

static int getNumEditorLogics() const#

Returns the current number of EditorLogic instances.

Return value

Current number of EditorLogic instances.

static int getNumWorldLogics() const#

Returns the current number of WorldLogic instances.

Return value

Current number of WorldLogic instances.

static int getNumSystemLogics() const#

Returns the current number of SystemLogic instances.

Return value

Current number of SystemLogic instances.

static int getNumArgs() const#

Returns the current number of command line arguments.

Return value

Current number of command line arguments.

static int getNumPlugins() const#

Returns the current number of loaded plugins.

Return value

Current number of loaded plugins.

static getPrecision() const#

Returns the current precision type.

Return value

Current precision type.

static Event getEventFocusLost() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventFocusGained() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventEndSwap() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventEndDeleteObjects() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventBeginDeleteObjects() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventEndPluginsSwap() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventBeginPluginsSwap() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventEndWorldSwap() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventBeginWorldSwap() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventEndPathfinding() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventBeginSwap() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventEndRender() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventEndPostRender() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventBeginPostRender() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventEndPluginsGui() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventBeginPluginsGui() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventEndRenderWorld() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventBeginRenderWorld() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventEndPluginsRender() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventBeginPluginsRender() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventEndEditorRender() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventBeginEditorRender() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventBeginRender() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventEndVRRender() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventBeginVRRender() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventAsyncEndFramePhysics() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventAsyncBeginFramePhysics() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventSyncEndFramePhysics() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventSyncBeginFramePhysics() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventBeginPathfinding() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventEndUpdate() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventEndFilesystemUpdate() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventBeginFilesystemUpdate() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventEndSpatialUpdate() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventBeginSpatialUpdate() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventEndPluginsPostUpdate() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventBeginPluginsPostUpdate() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventEndEditorPostUpdate() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventBeginEditorPostUpdate() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventEndSystemLogicPostUpdate() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventBeginSystemLogicPostUpdate() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventEndSystemScriptPostUpdate() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventBeginSystemScriptPostUpdate() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventEndWorldPostUpdate() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventBeginWorldPostUpdate() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventEndAnimationManagerUpdate() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventBeginAnimationManagerUpdate() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventEndWorldUpdate() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventBeginWorldUpdate() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventEndSystemLogicUpdate() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventBeginSystemLogicUpdate() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventEndSystemScriptUpdate() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventBeginSystemScriptUpdate() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventEndEditorUpdate() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventBeginEditorUpdate() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventEndVRUpdate() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventBeginVRUpdate() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventEndPluginsUpdate() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventBeginPluginsUpdate() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventEndSoundsUpdate() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventBeginSoundsUpdate() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventEndExpressionUpdate() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventBeginExpressionUpdate() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventEndRenderUpdate() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventBeginRenderUpdate() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventEndGameUpdate() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventBeginGameUpdate() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventEndSoundManagerUpdate() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventBeginSoundManagerUpdate() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventEndWorldManagerUpdate() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventBeginWorldManagerUpdate() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventEndControlsUpdate() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventBeginControlsUpdate() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventEndInputUpdate() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventBeginInputUpdate() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventEndPropertiesUpdate() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventBeginPropertiesUpdate() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

static Event getEventBeginUpdate() const#

The event handler signature is as follows: myhandler()

Usage Example

Source code

Return value

Event reference.

virtual 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.

static engine.getLibraryModulePath ( ) #

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

Return value

Path to the Engine's dynamic library file.

virtual engine.getArg ( int num ) =0#

Returns the command-line argument by its index.

Arguments

  • int num - Index of the argument.

Return value

Command-line argument

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.

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.beginOutsideLoopRender ( ) #

Starts a block of code where you can call Render class methods from outside the Engine's Loop. The end of this block should be marked with a call to the endOutsideLoopRender()() method.

void engine.endOutsideLoopRender ( ) #

Closes a block of code where you can call Render class methods from outside the Engine's Loop started with a call to the beginOutsideLoopRender()() method.

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.

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: 2024-03-29
Build: ()