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
双精度坐标
应用程序接口
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

Thread方法

警告
UnigineScript的应用范围仅限于实现与材质相关的逻辑(材质表达式,可编写脚本的材质,画笔材质)。 不要将UnigineScript用作应用程序逻辑的语言,请改用C#/C++,因为这些API是首选的。 无法保证UnigineScript中新引擎功能的可用性(超出其应用范围),因为当前的支持级别仅假设已解决关键问题。

int thread ( string function_name, variable arguments ) #

在列表上添加一个函数(FIFO)用于线程初始化。列表上的函数会在任意脚本函数执行的最后得到启用,执行的脚本函数从C++(所有脚本的init()shutdown()update())中进行调用。 目标函数必须使用wait语句为其它任务释放处理器。每个线程必须有自己的作用范围。

参数

  • string function_name - 将放置到列表中的函数名用于线程初始化。
  • variable arguments - 函数参数。

返回值

线程ID。可通过kill_thread()终止进程。

例子

源代码 (UnigineScript)
void log_argument(int arg) {
	while(1) {
		log.message("Argument: %d",arg);
		wait;
	}
}

for(int i = 0; i < 10; i++) {
	thread("log_argument",i);
}

int thread ( string function_name, variable array ) #

将函数放置在列表中(FIFO)用于线程初始化。函数参数数量可进行更改。

参数

  • string function_name - 将放置到列表中的函数名用于线程初始化。
  • variable array - 函数参数。参数数量可进行更改。

返回值

线程ID,可通过kill_thread()终止线程。

也可参看: 执行顺序

最新更新: 2021-10-25
Build: ()