This page has been translated automatically.
视频教程
界面
要领
高级
实用建议
专业(SIM)
UnigineEditor
界面概述
资源工作流程
版本控制
设置和首选项
项目开发
调整节点参数
Setting Up Materials
设置属性
照明
Sandworm
使用编辑器工具执行特定任务
如何擴展編輯器功能
嵌入式节点类型
Nodes
Objects
Effects
Decals
光源
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
编程
基本原理
搭建开发环境
使用范例
C++
C#
UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
材质和着色器
Rebuilding the Engine Tools
GUI
VR Development
双精度坐标
应用程序接口
Animations-Related Classes
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
VR-Related Classes
创建内容
内容优化
材质
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

Unigine Script Basic Utilities

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.

To use functions listed on this page include the unigine.h script into your project (it can be found in the data/core directory). All the functions of this script are safe.

The unigine.h script also defines math constants, color codes and data types (for single or double precision coordinates).

void swap ( variable v0, variable v1 ) #

Interchanges values of two variables.

Arguments

void sleep ( float time ) #

Causes the currently executing thread to sleep (cease execution) for the specified number of seconds. The sleep() function is thread-safe: when you set to sleep multiple threads, there are no side effects such as thread interferences appears.

Arguments

  • float time - Time of thread sleeping in seconds.

Node node_cast ( Node node ) #

Converts a base node to its derived type.

Arguments

  • Node node - Node to be type-casted.

Return value

Type-casted node.

Node node_clone ( Node node ) #

Clones a node and its children and then converts the node to its derived type. It is used for correct cloning of nodes that have assigned bodies and joints.

Arguments

  • Node node - Node to be cloned.

Return value

Type-casted copy of the node.

Node node_append ( Node node ) #

Establishes script ownership over the node and its children. It also casts nodes to their types. Do not forget, a node can have only one owner.

Arguments

  • Node node - Node to be appended.

Return value

Appended node.

Node node_remove ( Node node ) #

Releases script ownership over the node and its children. It also casts nodes to their types. Do not forget, that an orphan node need to be assigned to another owner.

Arguments

  • Node node - Node to be released.

Return value

Released node.

void node_delete ( Node node ) #

Deletes a node and its children.

Arguments

  • Node node - Node to be deleted.

Node node_load ( string name ) #

Loads a node from a file and establishes script ownership over it and its children. It also casts nodes to their types. If a node cannot be found, it will lead to the crash.

Arguments

  • string name - Node file to be loaded.

Return value

Loaded node.

int node_save ( string name, Node node ) #

Saves a node into a .node file.

Arguments

  • string name - File to save the node into.
  • Node node - Node to be saved.

Return value

1, if the node is saved successfully; otherwise, 0.

Node node_editor ( string name ) #

Gets an Engine Editor node by the name and casts it to its type.

Arguments

  • string name - Node name.

Return value

Type-casted node.

Body body_cast ( Body body ) #

Converts a base body to its derived type.

Arguments

  • Body body - Body to be type-casted.

Return value

Type-casted body.

Body body_clone ( Body body, Object object = NULL ) #

Clones the body and then converts it to its derived type. It also assigns a copy to a given object if necessary. This function correctly clones joints of the body.

Arguments

  • Body body - Body to be cloned.
  • Object object - Object, to which the copied body will be assigned. This is an optional argument.

Return value

Type-casted copy of the body.

Shape shape_cast ( Shape shape ) #

Converts a base shape to its derived type.

Arguments

  • Shape shape - Shape to be type-casted.

Return value

Type-casted shape.

Shape shape_clone ( Shape shape ) #

Clones the shape and then converts it to its derived type. This function correctly clones joints of the shape.

Arguments

  • Shape shape - Shape to be cloned.

Return value

Type-casted copy of the shape.

Joint joint_cast ( Joint joint ) #

Converts a base joint to its derived type.

Arguments

  • Joint joint - Joint to be type-casted.

Return value

Type-casted joint.

Joint joint_clone ( Joint joint ) #

Clones the joint and then converts it to its derived type. This function correctly clones the joints.

Arguments

  • Joint joint - Joint to be cloned.

Return value

Type-casted copy of the joint.

Widget widget_cast ( Widget widget ) #

Converts a base widget to its derived type.

Arguments

  • Widget widget - Widget to be type-casted.

Return value

Type-casted widget.

void body_traversal ( Body body, string name ) #

Calls a specified function for a given body and its children.

Arguments

  • Body body - Body to be passed to a function.
  • string name - Function to be called.

void body_shape_traversal ( Body body, string name ) #

Calls a specified function for shapes of a given body and body's children.

Arguments

  • Body body - Body, the shapes of which will be passed to a function.
  • string name - Function to be called.

void body_joint_traversal ( Body body, string name ) #

Calls a specified function for joints of a given body and body's children.

Arguments

  • Body body - Body, the joints of which will be passed to a function.
  • string name - Function to be called.

void node_traversal ( Node node, string name ) #

Calls a specified function for a given node and its children.

Arguments

  • Node node - Node to be passed to a function.
  • string name - Function to be called.

void node_body_traversal ( Node node, string name ) #

Calls a specified function for bodies of a given node and its children.

Arguments

  • Node node - Node, the body of which will be passed to a function.
  • string name - Function to be called.

void node_shape_traversal ( Node node, string name ) #

Calls a specified function for shapes of a given node and its children.

Arguments

  • Node node - Node, the shapes of which will be passed to a function.
  • string name - Function to be called.

void node_joint_traversal ( Node node, string name ) #

Calls a specified function for joints of a given node and its children.

Arguments

  • Node node - Node, the joints of which will be passed to a function.
  • string name - Function to be called.
Last update: 2023-12-19
Build: ()