This page has been translated automatically.
Подсказки и советы
Программирование на C#
Принципы работы
Свойства (properties)
Компонентная Система
Редактор UnigineEditor
Обзор интерфейса
Работа с ассетами
Настройки и предпочтения
Работа с проектами
Настройка параметров ноды
Setting Up Materials
Настройка свойств
Landscape Tool
Использование инструментов редактора для конкретных задач
Extending Editor Functionality
Встроенные объекты
Ноды (Nodes)
Объекты (Objects)
Источники света
World Nodes
Звуковые объекты
Объекты поиска пути
Настройка среды разработки
Примеры использования
Унифицированный язык шейдеров UUSL
File Formats
Rebuilding the Engine Tools
Двойная точность координат
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
Работа с контентом
Оптимизация контента
Material Nodes Library
Art Samples

Creating UnigineScript Application

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 UnigineScipt (beyond its scope of applications) is not guaranteed, as the current level of support assumes only fixing critical issues.

This article describes how to create an empty project and add logic to it by using the UnigineScript language. Code written in UnigineScript is the same for all supported platforms: Windows and Linux.

See Also#

Creating Empty UnigineScript Application#

After installing the UNIGINE SDK Browser and preparing development environment you can start your own UnigineScript-based project.

To create an empty UnigineScript API project, do the following:

  1. Open the UNIGINE SDK Browser.
  2. Go to the Projects tab and click CREATE NEW.

  3. Specify the following parameters:

    • Project — the name of your project.
    • Project Path — the path to your project folder.
    • SDK — the UNIGINE SDK.
    • API — choose UnigineScript only to start working with the UnigineScript.
    • Architecture — the architecture of your target platform.
    • Precision — choose double precision for this example.
    Read more about project parameters in this article.
  4. Click the Create New Project button. The project will appear in the projects list.

You can run your project by clicking the Run button.

Implementing UnigineScript Logic#

In this section we will add logic to the empty UnigineScript application project.

The following example shows how to add a primitive box mesh to the world and rotate it.

  1. In UNIGINE SDK Browser, choose the created UnigineScript project and click the Open Editor button.

  2. In Unigine Editor that opens, add a primitive box as described in this section. Also name the primitive as in the example.

  3. Save the World by clicking File -> Save World on the Menu bar or press CTRL + S and close Unigine Editor.
  4. In UNIGINE SDK Browser, choose your UnigineScript project and click the Open Folder button.

  5. Open the world script .usc file located in the <YOUR PROJECT FOLDER>/data/<YOUR PROJECT NAME>/ (in our case, it is script/data/script_project/script_project.usc file) by using any plain text editor or IDE.
  6. Modify the file by adding the following code:
    Source code (UnigineScript)
    #include <core/unigine.h>
    Node box;
    int init() {
    	PlayerSpectator camera = new PlayerSpectator();
    	// search the node by the specified name
    	int index = engine.editor.findNode("box");
    	// get the node by its index
    	if(index != -1) {
    		box = engine.editor.getNode(index);
    	return 1;
    int shutdown() {
    	return 1;
    int update() {
    	//check whether the node exists
    	if(box != NULL)
    		// get the frame duration
    		float ifps =;
    		// set the angle of rotation
    		float angle = ifps * 90.0f;
    		// get the current transformation of the node and apply rotation
    		mat4 transform = box.getTransform() * rotateZ(angle);
    		// set new transformation to the node
    	return 1;
    In the code above, we load the script_project/script_project.usc world script file. You should specify the name of your project's world script file.
  7. Save changes in the world script file.
  8. In the UNIGINE SDK Browser, click Run to launch the project

Last update: 10.04.2020
Build: ()