This page has been translated automatically.
Setting Up Development Environment
High-Level Systems
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
Double Precision Coordinates
Bounds-Related Classes
Controls-Related Classes
Core Library
Engine-Related Classes
GUI-Related Classes
Node-Related Classes
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
Rendering-Related Classes
Utility Classes
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.

New Logic System

Since Unigine 2.2 version the logic implementing of C++ and C# application has a different approach.

From now you don't need to interfere the main loop of the engine by yourself, the engine provides you classes which should be inherited.

The logic of these classes is the same as for runtime scripts:

New classes' methods are called automatically by engine after equivalent scripts' methods.

Prior Knowledge
This article assumes you have prior knowledge of the following topics. Please read them before proceeding:
When you created a new project, all necessary classes are inherited automatically from corresponding new logic system classes.

Essential Changes

In earlier Unigine versions, you need to interrupt the engine main loop by inserting your own my_update(), my_render(), my_swap() functions (when you develop C++/C# application). Here is a code example of such implementation:

Source code(C++)
while (engine->isDone() == 0) {

		// update in the main loop
		// update the application

		// render in the main loop

		// swap in the main loop

Engine calls these functions after all the functions inside Engine::update() were performed:

Now you should create new classes by inheriting WorldLogic, SystemLogic, EditorLogic classes and implement your methods inside (here's an example of AppWorldLogic.h):

Source code(C++)
#include <UnigineLogic.h>
#include <UnigineStreams.h>

class AppWorldLogic : public Unigine::WorldLogic {
	virtual ~AppWorldLogic();
	virtual int init();
	virtual int shutdown();
	virtual int destroy();
	virtual int update();
	virtual int render();
	virtual int flush();
	virtual int save(const Unigine::StreamPtr &stream);
	virtual int restore(const Unigine::StreamPtr &stream);

All the implemented WorldLogic class functions will be called by engine after corresponding world script's methods: init(), update(), etc.

You should implement these methods (since they are virtual), create the instance of these classes and pass it to the engine main function:

Source code(C++)
#include <UnigineEngine.h>

#include "AppSystemLogic.h"
#include "AppWorldLogic.h"
#include "AppEditorLogic.h"

using namespace Unigine;
#ifdef _WIN32
	int wmain(int argc,wchar_t *argv[]) {
	int main(int argc,char *argv[]) {
	AppSystemLogic system_logic;
	AppWorldLogic world_logic;
	AppEditorLogic editor_logic;
	Unigine::EnginePtr engine(UNIGINE_VERSION,argc,argv);
	return 0;

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