UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Landscape Tool
Using Editor Tools for Specific Tasks
FAQ
编程
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
应用程序接口
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
CIGI Client Plugin
Rendering-Related Classes

API Migration

Major Changes#

Breaking Changes#

The Memory Management system has been significantly reconsidered in UNIGINE 2.9. Now the Editor class automatically owns all pointers to nodes created in the Main loop via one of the following ways:

Source code (C++)
// creating a new node
NodeDummyPtr nodeDummy = NodeDummy::create();
NodeReferencePtr nodeReference = NodeReference::create("object.node");
ObjectMeshStaticPtr mesh = ObjectMeshStatic::create("material_ball.mesh");

// loading a node
NodePtr node = World::get()->loadNode("object.node");

// cloning a node
node->clone();
Or the same using C# API:
Source code (C#)
// creating a new node
NodeDummy nodeDummy = new NodeDummy();
NodeReference nodeReference = new NodeReference("object.node");
ObjectMeshStatic mesh = new ObjectMeshStatic("material_ball.mesh");

// loading a node
Node node = World.get().loadNode("object.node");

// cloning a node
node.clone();

This results in decreasing number of unexpected crashes and memory leaks. As an example, the following code used to cause a crash due to refering to a null pointer:

Source code (C++)
PlayerPtr createPlayer()
{
    PlayerDummyPtr player = PlayerDummy::create();
    return player->getPlayer();
    // the player variable used to delete the node it referred to on exiting the createPlayer function
}

int init()
{
    // setPlayer used a null pointer causing a crash
    Game::get()->setPlayer(createPlayer());
    return 1;
}

Now it works as expected. You don't have to use grab() and release() methods to handle ownership of a node anymore — it will be automatically removed on the world shutdown.

Node removal should be performed only via the following code:

Source code (C++)
World::get()->removeNode(node);

You can release a node from auto ownership by calling the release() method:

Source code (C++)
Editor::get()->releaseNode(node);

Such an orphan pointer stays in memory even after the world shutdown which may lead to memory leaks, so you should handle ownership manually.

Exceptions#

Nodes that are loaded or created not in the Main loop, as well as the ones loaded by using the AsyncQueue, are not handled by the Editor class. You should define their ownership manually via the following method:

Source code (C++)
node->release();
Editor::get()->addNode(node);

Smart Pointers Migration#

Warning
The changes described above will result in multiple crashes and run-time errors in almost any project based on previous SDKs.

The following workflow is recommended when migrating the code base of your projects to the new API:

  • get rid of all grab() and release() methods in the main thread. The isOwner() method is unlikely to be useful in the Main loop either.
  • you don't need the addNode() method of the Editor class anymore since nodes are added to the world when created.
  • don't use the Editor's removeNode() and destroy(node). Instead, it's recommended to remove nodes via the removeNode() method of the World class.

Body Class#

UNIGINE 2.8 UNIGINE 2.9
setID() Return value changed.
removeShape(Shape) Removed. Use removeShape() instead.

BoundBox Class#

New Functions#

Camera Class#

Editor Class#

UNIGINE 2.8 UNIGINE 2.9
getIntersection() Set of arguments changed.
getIntersection() Set of arguments changed.

Engine Class#

Game Class#

New Functions#

Image Class#

Light Class#

LightVoxelProbe Class#

UNIGINE 2.8 UNIGINE 2.9
setBakeInternalVolume() Set of arguments changed.
isBakeInternalVolume() Removed. Use getBakeInternalVolume() instead.

New Functions#

Material Class#

Node Class#

NodeReference Class#

UNIGINE 2.8 UNIGINE 2.9
setNodeName() Return value changed.

Object Class#

UNIGINE 2.8 UNIGINE 2.9
getIntersection() Set of arguments changed.
getIntersection() Set of arguments changed.

New Functions#

ObjectExternBase Class#

UNIGINE 2.8 UNIGINE 2.9
getIntersection() Set of arguments changed.

ObjectIntersection Class#

ObjectMeshCluster Class#

ObjectMeshClutter Class#

ObjectMeshSkinned Class#

UNIGINE 2.8 UNIGINE 2.9
getAnimationName() Removed. Use getAnimationPath() instead.

Player Class#

PropertyParameter Class#

Ptr Class#

New Functions#

Render Class#

UNIGINE 2.8 UNIGINE 2.9
setSkipClouds() Removed. Use setCloudsEnabled() instead.
isSkipClouds() Removed. Use isCloudsEnabled().
setSkipLights() Removed. Use setLightsEnabled() instead.
isSkipLights() Removed. Use isLightsEnabled() instead.
setSkipWater() Removed. Use setWaterEnabled() instead.
isSkipWater() Removed. Use isWaterEnabled() instead.
setSkipPostMaterials() Removed. Use setScreenSpaceEffects() instead.
isSkipPostMaterials() Removed. Use isScreenSpaceEffects() instead.
setSkipRenderMaterials() Removed. Use setPrePostMaterialsEnabled() instead.
isSkipRenderMaterials() Removed. Use isPrePostMaterialsEnabled() instead.
setSkipTransparent() Removed. Use setTransparentEnabled() instead.
isSkipTransparent() Removed. Use isTransparentEnabled() instead.
setSkipTransparentAmbient() Removed. Use setTransparentAmbient() instead.
isSkipTransparentAmbient() Removed. Use isTransparentAmbient() instead.
setSkipTransparentDeferred() Removed. Use setTransparentDeferred() instead.
isSkipTransparentDeferred() Removed. Use isTransparentDeferred() instead.
setSkipTransparentLight() Removed. Use setTransparentLight() instead.
isSkipTransparentLight() Removed. Use isTransparentLight() instead.
setSkipTransparentMultipleEnvProbes() Removed. Use setTransparentMultipleEnvProbes() instead.
isSkipTransparentMultipleEnvProbes() Removed. Use isTransparentMultipleEnvProbes() instead.
setRenderMaterials() Renamed to setPrePostMaterials().
getRenderMaterials() Renamed to getPrePostMaterials().
setShadowsSoft() Removed.
isShadowsSoft() Removed.
setShadowsSoftNoise() Removed.
getShadowsSoftNoise() Removed.
setShadowsSoftQuality() Removed.
getShadowsSoftQuality() Removed.
renderPostMaterial() Removed.
renderPostMaterial() Removed. Use renderScreenMaterial() instead.
renderPostMaterial() Removed. Use renderScreenMaterial() instead.
renderPostMaterial() Removed. Use renderScreenMaterial() instead.
renderComputeMaterial() Set of arguments changed.

New Functions#

Renderer Class#

UNIGINE 2.8 UNIGINE 2.9
getTextureRender() Removed. Use getRenderTarget() instead.
getPostTextureRender() Removed. Use getPostRenderTarget() instead.
hasGeodeticPivot() Return value changed.
isNode() Return value changed.
isReflection() Return value changed.
isShadow() Return value changed.
isStereo() Return value changed.
useDynamicReflections() Return value changed.
useOcclusionQueries() Return value changed.
usePostEffects() Return value changed.
useShadows() Return value changed.
useTAA() Return value changed.
useVelocityBuffer() Return value changed.
useVisualizer() Return value changed.
setShaderParameters() Argument type changed.
setShaderParameters() Argument type changed.
setShaderParameters() Argument type changed.
setShaderParameters() Argument type changed.
setShaderParameters() Argument type changed.

New Functions#

RenderState Class#

New Functions#

Shader Class#

Shape Class#

UNIGINE 2.8 UNIGINE 2.9
setID() Return value changed.

Sounds Class#

UNIGINE 2.8 UNIGINE 2.9
setCurrentDeviceName() Return value changed.

String Class#

StructuredBuffer Class#

Texture Class#

UGUID Class#

New Functions#

vec2 Class#

New Functions#

vec3 Class#

New Functions#

vec4 Class#

New Functions#

World Class#

UNIGINE 2.8 UNIGINE 2.9
getIntersection() Set of arguments changed.
getIntersection() Set of arguments changed.

New Functions#

WorldIntersection Class#

WorldSplineGraph Class#

WorldPortal Class#

New Functions#

AppProjectionInterface Class#

UNIGINE 2.8 UNIGINE 2.9
setGamma() Removed.
getGamma() Removed.
setBorderBlend() Set of arguments changed.
getBorderBlend() Return value changed.
setMaskBorderSize() Removed.
getMaskBorderSize() Removed.
setMaskOuterAlpha() Removed.
getMaskOuterAlpha() Removed.
setMaskInnerAlpha() Removed.
getMaskInnerAlpha() Removed.
setMaskPower() Removed.
getMaskPower() Removed.

New Functions#

Last update: 2019-07-18