纳金网

标题: Easy Threading 3.3 - 程序猿的小帮手 [打印本页]

作者: 狂风大尉    时间: 2015-11-30 19:11
标题: Easy Threading 3.3 - 程序猿的小帮手
Snap53.jpg

Requires Unity 5.2.2 or higher.

Work with multiple threads easily:

To build a truly responsive Unity game, you must keep long-running operations off of the main thread, and be careful to avoid blocking the main thread. This means you will need to execute various operations in the background.

Unity's coroutines are ALWAYS executed on the main Thread

Executing threads in the background implies carefully go back to the main thread when you have to manipulate Unity's objects.

Piece of cake with this package, just use this sentence:
Task.RunInMainThread(SomeFunction);
SomeFunction is guaranteed to be executed in the main thread

Of course i's possible to use lambda expressions:
Task.RunInMainThread(()=>
{
// This code will execute in the main thread
});


But this asset also makes working with threads a pleasant experience:

To create a thread just use the following syntax:
Task.Run (DoSomeWorkOnABackgroundThread);

Creating a thread that returns some value (an integer in this example):
Task<int>.Run (CalculateSomeIntegerInTheBackground),

Of course you will want to receive the integer:
Task<int>.Run (CalculateSomeIntegerInTheBackground).ContinueWith(ThisFunctionReceivesTheIntegerAsParameter);

Or, maybe, you need to show that integer to the player (the function receiving itmust be executed in the main thread):
Task<int>.Run (CalculateSomeIntegerInTheBackground).ContinueInMainThreadWith(ThisFunctionReceivesTheIntegerAsParameter);

These are just the basic features included in this package.

This package reimplements and extends the .NET System.Threading.Tasksnamespace.

This namespace makes thread management easier for you by adding a class named Task. A task represents an asynchronous operation. Typically, a Task is returned from an asynchronous function and gives the ability to continue processing the result of the task.
A task is not tied to a particular threading model: it represents the work being done, not where it is executing. Tasks have many advantages over other methods of asynchronous programming such as callbacks and the event model.

Tested for standalone builds, web player, iOS and Android


Full source code is included, as well as many examples. I use this asset for my own projects, so I will keep improving and expanding it.

Easy Threading.rar

58.11 KB, 下载次数: 862


作者: aliqi    时间: 2015-12-1 14:44
如果真如作者所描述的那样的话,Task任务管理是容易不少了。。
作者: mew409396598    时间: 2015-12-4 16:03
看描述比Loom好用?
作者: idrsky    时间: 2015-12-4 20:42
分享资源是坏的
作者: buzheteng    时间: 2015-12-9 21:33
太高级了,还不知道怎么用。。。
作者: wgl3210    时间: 2015-12-30 17:11
看一看,感谢分享~
作者: vang111    时间: 2016-3-17 20:07
压缩包是无法解压的额
作者: 云龙神3    时间: 2016-4-11 14:38
下都下不下来
作者: 艾西格亚    时间: 2016-4-11 18:33
云龙神3 发表于 2016-4-11 14:38
下都下不下来

已经更新下载文件
作者: wangxiaogangan    时间: 2016-5-6 10:10
不错不错  哈哈哈和
作者: Coki    时间: 2016-5-8 14:10
这个广告图太萌了,冲着它来顶一下
作者: zombieman    时间: 2016-5-8 14:34
好东西收下了,感谢楼主分享
作者: 告别永恒    时间: 2016-8-10 14:31
很高大上的工具!!
作者: abc123zxq123    时间: 2016-8-25 21:56
什么功能没看懂
作者: lantiszhu    时间: 2016-10-27 14:13
unity多线程不是有限制吗,看看好用不
作者: symanl    时间: 2016-11-15 09:52
貌似很强大啊,下来瞧瞧,谢谢分享
作者: 打打打个大西瓜    时间: 2017-2-25 21:56
多谢分享
作者: 王勇    时间: 2017-2-28 17:42
关注了  那个 也没有这个资源啊
作者: sdw1100    时间: 2017-2-28 17:43
先收藏!感谢分享
作者: candotoo    时间: 2017-3-15 16:02
好东西 支持一个
作者: liruishenga    时间: 2017-4-6 17:27
感谢分享,哈哈
作者: JBLJBL    时间: 2017-6-19 14:53
无法下载,提示不存在




欢迎光临 纳金网 (http://go.narkii.com/club/) Powered by Discuz! X2.5