This page has been translated automatically.
Видеоуроки
Interface
Essentials
Advanced
Подсказки и советы
Основы
Программирование на C#
Рендеринг
Professional (SIM)
Принципы работы
Свойства (properties)
Компонентная Система
Рендер
Физика
Редактор UnigineEditor
Обзор интерфейса
Работа с ассетами
Настройки и предпочтения
Работа с проектами
Настройка параметров ноды
Setting Up Materials
Настройка свойств
Освещение
Landscape Tool
Sandworm
Использование инструментов редактора для конкретных задач
Расширение функционала редактора
Встроенные объекты
Ноды (Nodes)
Объекты (Objects)
Эффекты
Декали
Источники света
Geodetics
World Nodes
Звуковые объекты
Объекты поиска пути
Players
Программирование
Основы
Настройка среды разработки
Примеры использования
C++
C#
UUSL (Unified UNIGINE Shader Language)
Плагины
Форматы файлов
Materials and Shaders
Rebuilding the Engine Tools
GUI
Двойная точность координат
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
Работа с контентом
Оптимизация контента
Материалы
Визуальный редактор материалов
Сэмплы материалов
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials
Внимание! Эта версия документация УСТАРЕЛА, поскольку относится к более ранней версии SDK! Пожалуйста, переключитесь на самую актуальную документацию для последней версии SDK.
Внимание! Эта версия документации описывает устаревшую версию SDK, которая больше не поддерживается! Пожалуйста, обновитесь до последней версии SDK.

Call()

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.

variable call ( string function_name, variable arguments ) #

Calls a function, which name is provided as an argument.
Notice
The above expression is equivalent to this one: function_name(arguments).

Arguments

  • string function_name - Name of the function to call.
  • variable arguments - Function arguments.

Return value

Function execution result.

Examples

Source code (UnigineScript)
call("log.message","%d %s\n",13,"some text");

// the result is: 13 some text

variable call ( int function_id, variable arguments ) #

Calls a function by its ID, which is almost as fast as the direct function call. In order to get this ID, use get_function().

Arguments

  • int function_id - ID of the function to call.
  • variable arguments - Function arguments.

Return value

Function execution result.

Examples

Source code (UnigineScript)
void foo(int a) {
	log.message("%d\n",a);
}

int id = get_function("foo",1);	
call(id,3);

// the result is: 3
If you need to call a user class method by its ID rather then as a static method, you can use the following:
Source code (UnigineScript)
class MyClass {
    
    void print_me() {
        log.message("MyClass::print_me() called\n");
    }
    
    void id_func(MyClass obj) {
        obj.print_me();
    }
};

MyClass m = new MyClass();
call(get_function("MyClass::id_func",1),m);

// the result is: MyClass::print_me() called
Also you can call the id_func() function as follows:
Source code (UnigineScript)
int id = get_function("MyClass::id_func",1);
m.call(id,m);

variable call ( string function_name, variable array ) #

Calls a function, whose name is provided as an argument. The number of function arguments can vary.

Arguments

  • string function_name - Name of the function to call.
  • variable array - Function arguments. The number of function arguments can vary.

Return value

Function execution result.

Examples

Source code (UnigineScript)
int args[] = ("%s\n","hello world");
call("log.message",args);

// ouput: hello world

variable call ( string method_name, variable arguments ) #

Calls methods of external or user-defined classes.

Arguments

  • string method_name - Name of the method to call.
  • variable arguments - Function arguments.

Return value

Function execution result.

Examples

Call methods of an external class:

Source code (UnigineScript)
File file = new File("test.cpp","rb");
log.message("%d %s\n",file.call("isOpened"),file.call("getName"));
file.call("close");	// same as file.close();
delete file;

// the output is: 1 test.cpp
Call a method of a user-defined class:
Source code (UnigineScript)
class Foo {
	void print(int a) {
		log.message("Foo::print(): %d\n",a);
	}
};
Foo foo = new Foo();
foo.print(1);
foo.call("print",2);

// Foo::print(): 1
// Foo::print(): 2
Last update: 10.03.2022
Build: ()