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

API Migration

Major Changes#

Breaking Changes#

Revamped Window Manager and Engine Integration#

We have replaced the old CustomApp-based workflow with a new one. A new CustomSystemProxy concept to be used instead of the CustomApp incorporates definition of available functions (windows creation and management, input management, additional functionality like dialogs, clipboard, etc.) along with all necessary overrides. The functionality of some Engine subsystems is to be defined depending on the set of functions made available by the user. This class forms the basis for the operation of WindowManager, Input, GUI, Displays, etc.

Notice
The App class has been removed with some of its functionality moved to other classes (Input, Gui, Engine, WindowManager), for more information please refer to the App Class section below.

A separate proxy implementation is required for each integration environment (SystemProxySDL, SystemProxyQt, SystemProxyWPF, etc.).

The new CustomSystemProxy-based workflow has resolved the following issues:

  • inability to create a window without using platform-dependent code;
  • inability to create a separate rendering window without any plugins;
  • code duplication (the same window creation functionality in all applications);
  • only a part of functionality of the main window is available for other windows (GUI, Input, ...);
  • inability to obtain information on physical configuration of displays (monitor resolution, main monitor, etc.);
  • missing "window" concept and unclear API as a result;

We have simplified our own App* plugins moving similar functionality out and eliminating problems related to integration into applications created on the basis of third-party frameworks (such as inability to use VR in Qt or WPF applications).

Input System#

To unify processing of the mouse and keyboard inputs we have extended the Input class. New functionality covers methods that were used for input in the App class. All keyboard keys and mouse buttons have been moved to this class. Input buffer is now used to avoid missing input events at low framerates. Input events can be received as a buffer, you can create user events and dispatch them to the Engine via Input.SendEvent(). Input event filter is also available enabling you to reject certain input events for the Engine and get necessary information on all input events. This filter is configured via Input.SetEventsFilter(). Event filter is also available for WindowManager (see WindowManager.SetEventsFilter()) enabling you to receive all events for windows coming from the SystemProxy and filter them out.

Extended Set of Callbacks#

From now on, access to a wide range of input event callbacks is available: MOUSE, KEY, TEXT, TOUCH, and IMMEDIATE_INPUT. Text input callback allows getting a symbol in Unicode format. The user is getting an unsigned char, then it is translated into a proper code (for example: If Shift+q is pressed, then we get “Q”, and not just a key symbol).

New Keys#

The KEY enumeration now contains scan codes of buttons according to the QWERTY layout (indicating physical positions on the keyboard). This ensures standardization of controls to the same layout for every keyboard type, with the same button opening the console everywhere. You can obtain a symbol corresponding to the key taking into account current keyboard layout (QWERTY, QWERTZ, AZERTY), modifiers, etc. via the Input.KeyToUnicode() method, or use Input.UnicodeToKey() to get a scan code for a certain unicode symbol. To work with keys use Input.IsKeyDown(), Input.IsKeyPressed(), and Input.isKeyUp().

Moreover, paired keys (Ctrl, Alt, Shift, etc.) are now separated (LEFT_SHIFT, RIGHT_SHIFT, LEFT_ALT, etc.) making it easy to determine any pressed key on QWERTY, QWERTZ, and AZERTY keyboards.

Working with Multiple Displays#

The new Displays class allows getting information about connected displays. You can get the number of screen displays and the index of the main one. With those indices, you can identify their position and size in pixels. Also, there is access to the name and current dpi. Apart from that, there are functions for obtaining available modes for displays. You can get the number of modes and by their index get resolution and refresh rate.

Window Manager#

For windows creation, we have added a new EngineWindow class. All window management operations are performed via this manager enabling you to access any window of the application, group or stack windows, create various dialogs, etc.

A set of samples has been added to Sim SDK to demonstrate various aspects of use (samples/Api/WindowManager).

Interface Plugin Removed#

We have removed the Interface plugin as its functionality has been covered by the updates described above.

App Class (Removed)#

The App class has been removed in the framework of Window Manager and Engine Integration modifications (see details here).

Some of the functionality has been transferred to other classes:

  • input-related functions -> Input class.
  • window management functions -> WindowManager class.
  • application-level functions -> Engine class.
  • some mouse-related functions -> Gui class.
UNIGINE 2.15.1 UNIGINE 2.16
Source code (C#)
// enabling constant background update 
// even when the Engine window is out of focus 
App.SetBackgroundUpdate(true);
Source code (C#)
// enabling constant background update 
// even when the Engine window is out of focus 
Engine.BackgroundUpdate = true;
Source code (C#)
// getting points to detect intersection 
// based on mouse position and player direction
Vec3 p0 = Game.Player.WorldPosition;
Vec3 p1 = p0 + Game.Player.GetDirectionFromScreen() * distance;
Source code (C#)
// get points to detect intersection 
// based on mouse position and player direction
Vec3 p0 = Game.Player.WorldPosition;
ivec2 m_p = Input.MousePosition;
Vec3 p1 = p0 + Game.Player.GetDirectionFromMainWindow(m_p.x, m_p.y) * 100;
Source code (C#)
// calculating aspect ratio from the screen size

int width = App.GetWidth();
int height = App.GetHeight();

float aspect = (float)(width) / height;
Source code (C#)
// calculating aspect ratio from the screen size
EngineWindow main_window = WindowManager.MainWindow;
if (!main_window)
	Engine.Quit();

ivec2 main_size = main_window.Size;

float aspect = (float)(main_size.y) / main_size.x;
Source code (C#)
// getting the last frame time
time += App.GetIFps();
Source code (C#)
// getting the last frame time
time += Engine.IFps;
Source code (C#)
// displaying a dialog message
App.DialogMessage("Package", "This is my Package!");
Source code (C#)
// displaying a dialog message
WindowManager.DialogMessage("Package", "This is my Package!");
Source code (C#)
// clamping framerate to 60 if VSync is off
if ((App.GetFlags() & App.VSYNC) == 0 ||
	(App.GetFlags() & App.FULLSCREEN) == 0)
	Render.MaxFPS = 60;
Source code (C#)
// clamping framerate to 60 if VSync is off
EngineWindow main_wnd = WindowManager.MainWindow;
if (!main_wnd)
	Engine.Quit();

if (Render.VSync == Render.VSYNC.DISABLE || 
	!main_wnd.IsFullscreen)
	Render.MaxFPS = 60;
Source code (C#)
// setting handlers for different input events
App.SetKeyPressFunc(OnKeyPress);
App.SetKeyReleaseFunc(OnKeyRelease);

App.SetButtonPressFunc(OnBtnPress);
App.SetButtonReleaseFunc(OnBtnRelease);

App.SetKeyPressUnicodeFunc(OnUKeyPress);
Source code (C#)
// setting handlers for different input events
hKeyPress = Input.AddCallback(Input.CALLBACK_INDEX.KEY_DOWN, OnKeyPress);
hKeyRelease = Input.AddCallback(Input.CALLBACK_INDEX.KEY_UP, OnKeyRelease);

hBtnPress = Input.AddCallback(Input.CALLBACK_INDEX.MOUSE_DOWN, OnBtnPress);
hBtnRelease = Input.AddCallback(Input.CALLBACK_INDEX.MOUSE_UP, OnBtnRelease);

hUKeyPress = Input.AddCallback(Input.CALLBACK_INDEX.TEXT_PRESS, OnUKeyPress);
Source code (C#)
// getting mouse coords and wheel scroll information
int mouse_x = App.GetMouseX();
int mouse_y = App.GetMouseY();

MousePos = new System.Numerics.Vector2(mouse_x , mouse_y);
MouseWheel += (float)(App.GetMouseAxis(App.AXIS_Y));
MouseWheelH += (float)(App.GetMouseAxis(App.AXIS_X));
Source code (C#)
// getting mouse coords and wheel scroll information
EngineWindow main_wnd = WindowManager.MainWindow;
if (!main_wnd)
	Engine.Quit();
	
int mouse_x = Input.MousePosition.x - main_wnd.Position.x;
int mouse_y = Input.MousePosition.y - main_wnd.Position.y;

MousePos = new System.Numerics.Vector2(mouse_x , mouse_y);
MouseWheel += Input.MouseWheel;
MouseWheelH += Input.MouseWheelHorizontal;
Source code (C#)
// checking keyboard input
bool KeyCtrl = App.GetKeyState(App.KEY_CTRL) != 0;
bool KeyShift = App.GetKeyState(App.KEY_SHIFT) != 0;

if (App.ClearKeyState('c') == 1)
{
	// perform action 1
}
else if (App.ClearKeyState(App.KEY_PGUP) == 1)
{
	// perform action 2
}
else if (App.ClearKeyState(App.KEY_PGDOWN) == 1)
{
	// perform action 3
}
Source code (C#)
// checking keyboard input
bool KeyCtrl = (Input.IsKeyPressed(Input.KEY.LEFT_CTRL) || Input.IsKeyPressed(Input.KEY.RIGHT_CTRL));
bool KeyShift = Input.IsKeyPressed(Input.KEY.ANY_SHIFT);

if (Input.IsKeyDown(Input.KEY.C))
{
	// perform action 1
}
else if (Input.IsKeyDown(Input.KEY.PGUP))
{
	// perform action 2
}
else if (Input.IsKeyDown(Input.KEY.PGDOWN))
{
	// perform action 3
}
Source code (C#)
// closing the application on clicking the right mouse button
if (App.ClearMouseButtonState(App.BUTTON_RIGHT) != 0)
	 App.Exit();
Source code (C#)
// closing the application on clicking the right mouse button
if (Input.IsMouseButtonDown(Input.MOUSE_BUTTON.RIGHT))
	Engine.Quit();

CustomApp Class (Removed)#

The CustomApp class has been removed in the framework of Window Manager and Engine Integration modifications (see details here).

The RenderContext class has been removed. Functions related to render context were transferred to the Render class.

For detailed information on the new CustomSystemProxy-based integration workflow please refer to the Integrating with Frameworks article.

UNIGINE 2.15.1 UNIGINE 2.16
Source code (C#)
// getting D3D11 Device and Context
IntPtr ctx = CustomApp.GetD3D11Context();
IntPtr device = CustomApp.GetD3D11Device();
Source code (C#)
// getting D3D11 Device and Context
IntPtr ctx = Render.GetD3D11Context();
IntPtr device = Render.GetD3D11Device();

Joystick and Gamepad Controls Changes#

Interaction is now implemented using SDL library. Joysticks and gamepads now work on Windows and Linux and support hot-plugging. So, you can connect your joystick or gamepad before or after creating an instance of the corresponding class.

You can now create multiple ControlsJoystick and ControlsGamepad having the same numbers. For both of these devices you can access device type (wheel, throttle, etc.) and model.

The ControlsXPad360 class has transformed into ControlsGamepad class, which is now responsible for all gamepads, so the ControlsSixAxis class has been removed.

The following updates were made to the ControlsGamepad class:

  • Added new device types (wheel, throttle, etc.). See the DEVICE_TYPE_* enum of the Input class and DeviceType.
  • Added device model types (XBox 360, XBox One, PS3, etc.). See the MODEL_TYPE_* enum and ModelType.
  • Some devices support connection of multiple players (e.g., XBox 360 supports up to four players connected through XBox 360 gamepads). Now you can get this index via PlayerIndex.
  • Methods setLeftMotor() and setRightMotor() were removed. Vibration for low-frequency and high-frequency motors is now managed via the new setVibration() method enabling you to control vibration duration as well.
  • The getName() now returns the user-friendly name of the gamepad, not the name of its type ("GamePad", "Wheel" etc.)

See the details for other affected classes:

ARTTracker Class#

UNIGINE 2.15.1 UNIGINE 2.16
GetBodyId( int ) Renamed as GetBodyID( int ).
GetFlyStickId( int ) Renamed as GetFlyStickID( int ).
GetMeaToolId( int ) Renamed as GetMeaToolID( int ).
GetMeaRefId( int ) Renamed as GetMeaRefID( int ).
GetMarkId( int ) Renamed as GetMarkID( int ).
GetHandId( int ) Renamed as GetHandID( int ).
GetHumanId( int ) Renamed as GetHumanID( int ).
GetHumanJointId( int ) Renamed as GetHumanJointID( int ).
GetInertialId( int ) Renamed as GetInertialID( int ).

BootConfig Class#

UNIGINE 2.15.1 UNIGINE 2.16
Property ScreenMessagePluginsInit Removed.
SetScreenMessagePluginsInit( string ) Removed.
GetScreenMessagePluginsInit( ) Removed.

New Properties

Contact Class#

UNIGINE 2.15.1 UNIGINE 2.16
Property Id Renamed as ID.

Controls Class#

UNIGINE 2.15.1 UNIGINE 2.16
TYPE.CONTROLS_SIX_AXIS Removed. Use TYPE.CONTROLS_GAMEPAD instead.
TYPE.CONTROLS_X_PAD360 Removed. Use TYPE.CONTROLS_GAMEPAD instead.

New Functions

ControlsApp Class#

UNIGINE 2.15.1 UNIGINE 2.16
SetStateButton( int, int ) Renamed as SetStateMouseButton( int, Input.MOUSE_BUTTON ).
GetStateButton( int ) Renamed as GetStateMouseButton( int ).
IsStateButton( int ) Renamed as IsStateMouseButton( Input.MOUSE_BUTTON ).

New Properties

ControlsJoystick Class#

The following changes were made for this release:

  • Joysticks now support hot-plugging. So, you can connect your joystick before or after create an instance of this class.
  • Added new device types (wheel, throttle, etc.). See the DEVICE_TYPE_* enum of the Input class and the DeviceType property.
  • Some devices support connection of multiple players (e.g., XBox 360 supports up to four players connected through XBox 360 gamepads). Now you can get this index via the PlayerIndex property.
  • Added an initial value for joystick axes (available via getAxisInitialValue(int) ).
  • Added a new enum for the states of the POV (Point-of-View) switch or DPad (POV_*)
  • Both GuidProduct and GuidInstance were removed. Now you should operate with Guid, Vendor, Product, and ProductVersion. The Guid is created on the basis of vendor and product identifiers and product version number. It enables you to identify device model (Controller XBox One, etc.), however, it will be the same for two identical models.
UNIGINE 2.15.1 UNIGINE 2.16
Property GuidInstance Removed.
Property GuidProduct Removed.

New Functions

Curve2d Class#

New Functions

Decal Class#

New Properties

Dir Class#

UNIGINE 2.15.1 UNIGINE 2.16
Mkdir( int ) Behavior changed.
Mkdir( string, int ) Behavior changed.

Editor Class#

UNIGINE 2.15.1 UNIGINE 2.16
VideoRestart( - ) Removed.

EditorLogic Class#

UNIGINE 2.15.1 UNIGINE 2.16
Render( EngineWindow ) Set of arguments changed.

The following changes shoud be made to the AppEditorLogic.cs file of your project.

UNIGINE 2.15.1 UNIGINE 2.16
Source code (C#)
public override bool Render()
Source code (C#)
public override bool Render(EngineWindow window)

Engine Class#

UNIGINE 2.15.1 UNIGINE 2.16
IsDone Renamed as IsQuit.
Update( ), Render( ), Swap( ) Removed, use Iterate( ) instead.

New Properties

New Functions

Gui Class#

Due to the fact that now there may be several windows, a concept of the current GUI has come into play, to get the current GUI of the current main window use GetCurrent() method:

UNIGINE 2.15.1 UNIGINE 2.16
Source code (C#)
// adding a child WidgetLabel element to the current GUI
Gui gui = Gui.Get();
WidgetLabel widget_label = new WidgetLabel(gui, "Label text:");
gui.AddChild(widget_label, Gui.ALIGN_OVERLAP | Gui.ALIGN_FIXED);
Source code (C#)
// adding a child WidgetLabel element to the current GUI
Gui gui = Gui.GetCurrent();
WidgetLabel widget_label = new WidgetLabel(gui, "Label text:");
gui.AddChild(widget_label, Gui.ALIGN_OVERLAP | Gui.ALIGN_FIXED);

Input Class#

UNIGINE 2.15.1 UNIGINE 2.16
Property MouseDelta Renamed as MouseDeltaRaw.
Property MouseCoord Renamed as MousePosition.
Property MouseCoordDelta Renamed as MouseDeltaPosition.

New Functions

New Properties

InputGamePad Class#

Landscape Class#

LandscapeLayerMap Class#

LandscapeMapFileSettings Class#

LandscapeMapFileCompression Class#

UNIGINE 2.15.1 UNIGINE 2.16
COMPRESSOR_TYPE.NONE variable. Removed. Use Landscape.COMPRESSOR_TYPE.NONE instead.
COMPRESSOR_TYPE.JACKALLESS variable. Removed. Use Landscape.COMPRESSOR_TYPE.JACKALLESS instead.
COMPRESSOR_TYPE.LZ4 variable. Removed. Use Landscape.COMPRESSOR_TYPE.LZ4 instead.
COMPRESSOR_TYPE.ZLIB variable. Removed. Use Landscape.COMPRESSOR_TYPE.ZLIB instead.
Property IsLoaded Removed.
Property IsCompressed Removed. Use LandscapeMapFileSettings.IsCompressed instead.
Run( bool, bool ) Removed. Use Compress( bool, bool ) and Decompress( bool, bool ) instead.
IsLoaded( ) Removed.
Load( UGUID ) Removed.

New Functions

LeapMotionFinger Class#

UNIGINE 2.15.1 UNIGINE 2.16
Property Id Renamed as ID.

LeapMotionHand Class#

UNIGINE 2.15.1 UNIGINE 2.16
Property Id Renamed as ID.

LeapMotion Class#

UNIGINE 2.15.1 UNIGINE 2.16
GetHandById( int ) Renamed as GetHandByID( int ).
GetFingerFromHandById( int ) Renamed as GetFingerFromHandByID( int ).

Light Class#

UNIGINE 2.15.1 UNIGINE 2.16
Property ShadowScreenSpaceViewBias Removed.
Property ShadowScreenSpaceNoiseTranslucent Removed.
SetShadowScreenSpaceNoiseTranslucent( float ) Removed.
GetShadowScreenSpaceNoiseTranslucent( ) Removed.
SetShadowScreenSpaceViewBias( float ) Removed.
GetShadowScreenSpaceViewBias( ) Removed.

New Properties

LightEnvironmentProbe Class#

New Properties

LightPlanarProbe Class#

New Properties

Material Class#

UNIGINE 2.15.1 UNIGINE 2.16
TEXTURE_SOURCE_CURVE Renamed as TEXTURE_SOURCE_RAMP.
WIDGET.TEXTURE_CURVE Renamed as WIDGET.TEXTURE_RAMP.
Property IsEngine Renamed as IsFileEngine.
GetTextureCurve( int ) Renamed as GetTextureRamp( int ).
GetTextureCurveOverride( int ) Renamed as GetTextureRampOverride( int ).
DestroyShaders( ) Removed.

New Functions

Materials Class#

Node Class#

UNIGINE 2.15.1 UNIGINE 2.16
GetTypeId( string ) Renamed as GetTypeID( string ).

ObjectGuiMesh Class#

New Properties

ObjectMeshStatic Class#

Player Class#

Due to the fact that now there may be several windows, methods GetDirectionFromScreen(), GetProjectionFromScreen() и GetScreenPosition() were changed. Now there is a group of similar methods available for direction, projection, and position (relative to the current main window, relative to the specified window, relative to the screen):

All coords-related arguments (mouse_x, mouse_y, screen_x, screen_y), are now specified in world coordinates.

There are no default -1 values for coordinates and size arguments anymore to avoid ambiguity.

UNIGINE 2.15.1 UNIGINE 2.16
GetDirectionFromScreen( ) Set of arguments changed.
GetDirectionFromScreen( ) Set of arguments changed.

New Functions

Plugin Class#

UNIGINE 2.15.1 UNIGINE 2.16
Gui( - ) Set of arguments changed.
Render( - ) Set of arguments changed.

Property Class#

New Properties

Render Class#

UNIGINE 2.15.1 UNIGINE 2.16
Property ColorCorrectionCurve Renamed as ColorCorrectionRamp.
Property ShadowShaftsLength Removed. Use ScreenSpaceShadowShaftsLength instead.
Property ShadowShaftsExposure Removed.
Property ShadowShafts Removed. Use ScreenSpaceShadowShaftsMode instead.
Property LandscapeTerrainCullingBackFace Removed.
Property LandscapeTerrainCullingFrustumPadding Removed.
Property LandscapeTerrainCullingAggressive Removed.
Property LandscapeTerrainGeometryFadeLods Removed.
Property MotionBlurNeatSilhouettes Removed.
Property SSRNoiseStep Removed.
Property SSRNoiseRay Removed.
Property SSRFastTracing Removed.
GetScreenshot( Image ) Removed.
ResetColorCorrectionCurve( ) Renamed as ResetColorCorrectionRamp( ).
ResetColorCorrectionSaturationCurve( ) Renamed as ResetColorCorrectionSaturationRamp( ).
GetBlack2DArrayTexture( ) Set of arguments changed.
GetBlack2DTexture( ) Set of arguments changed.
GetBlack2DUIntTexture( ) Set of arguments changed.
GetBlack3DTexture( ) Set of arguments changed.
GetBlackCubeTexture( ) Set of arguments changed.
GetGray2DArrayTexture( ) Set of arguments changed.
GetGray2DTexture( ) Set of arguments changed.
GetGray2DUIntTexture( ) Set of arguments changed.
GetGray3DTexture( ) Set of arguments changed.
GetGrayCubeTexture( ) Set of arguments changed.
GetWhite2DArrayTexture( ) Set of arguments changed.
GetWhite2DTexture( ) Set of arguments changed.
GetWhite2DUIntTexture( ) Set of arguments changed.
GetWhite3DTexture( ) Set of arguments changed.
GetWhiteCubeTexture( ) Set of arguments changed.

New Functions

New Properties

RenderEnvironmentPreset Class#

Renderer Class#

RenderState Class#

New Functions

RenderTarget Class#

Shader Class#

New Properties

ShapeContact Class#

UNIGINE 2.15.1 UNIGINE 2.16
Property Id Renamed as ID.

TerrainDetailMask Class#

TeslaSuit::Suit Class#

UNIGINE 2.15.1 UNIGINE 2.16
GetId( ) Renamed as GetID( ).
GetSourceMapId( ) Renamed as GetSourceMapID( ).

Texture Class#

UNIGINE 2.15.1 UNIGINE 2.16
All texture sampler flags. Renamed with the SAMPLER_ prefix.
All texture format flags. Renamed with the FORMAT_ prefix, along with a new FORMAT_MIPMAPS flag added.
Property Flags Removed. Use SamplerFlags, FormatFlags, and AllFlags instead.
IsBilinear( ) Removed.

New Properties

UGUID Class#

UNIGINE 2.15.1 UNIGINE 2.16
IsEmpty( ) Return value type changed.
IsValid( ) Return value type changed.

UserInterface Class#

New Properties

Widget Class#

WidgetCanvas Class#

WidgetExternBase Class#

New Functions

WidgetScroll Class#

WidgetTreeBox Class#

New Properties

World Class#

UNIGINE 2.15.1 UNIGINE 2.16
GetNodeById( int ) Renamed as GetNodeByID( int ).

Varjo Class#

Last update: 2022-11-18
Build: ()