123 第1页 | 共3 页下一页
返回列表 发新帖
查看: 8169|回复: 22
打印 上一主题 下一主题

[插件资源] Easy Threading 3.3 - 程序猿的小帮手

[复制链接]

2722

主题

42

听众

3万

积分

资深设计师

Rank: 7Rank: 7Rank: 7

纳金币
38266
精华
111

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

跳转到指定楼层
楼主
发表于 2015-11-30 19:11:01 |只看该作者 |倒序浏览
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

分享到: QQ好友和群QQ好友和群 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
转播转播0 分享淘帖0 收藏收藏1 支持支持0 反对反对0
回复

使用道具 举报

aliqi    

0

主题

4

听众

921

积分

初级设计师

Rank: 3Rank: 3

纳金币
112
精华
0

最佳新人

沙发
发表于 2015-12-1 14:44:47 |只看该作者
如果真如作者所描述的那样的话,Task任务管理是容易不少了。。
回复

使用道具 举报

0

主题

4

听众

718

积分

初级设计师

Rank: 3Rank: 3

纳金币
10
精华
0

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

板凳
发表于 2015-12-4 16:03:02 |只看该作者
看描述比Loom好用?
回复

使用道具 举报

0

主题

1

听众

236

积分

设计实习生

Rank: 2

纳金币
6
精华
0

最佳新人

地板
发表于 2015-12-4 20:42:06 |只看该作者
分享资源是坏的
回复

使用道具 举报

0

主题

1

听众

172

积分

设计实习生

Rank: 2

纳金币
15
精华
0

最佳新人

5#
发表于 2015-12-9 21:33:01 |只看该作者
太高级了,还不知道怎么用。。。
回复

使用道具 举报

0

主题

7

听众

544

积分

初级设计师

Rank: 3Rank: 3

纳金币
203
精华
0

最佳新人

6#
发表于 2015-12-30 17:11:26 |只看该作者
看一看,感谢分享~
回复

使用道具 举报

0

主题

1

听众

1769

积分

助理设计师

Rank: 4

纳金币
534
精华
0

活跃会员

7#
发表于 2016-3-17 20:07:06 |只看该作者
压缩包是无法解压的额
回复

使用道具 举报

0

主题

2

听众

751

积分

初级设计师

Rank: 3Rank: 3

纳金币
20
精华
0

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

8#
发表于 2016-4-11 14:38:09 |只看该作者
下都下不下来
回复

使用道具 举报

955

主题

164

听众

7万

积分

版主

Rank: 7Rank: 7Rank: 7

纳金币
59338
精华
28

活跃会员 荣誉管理 突出贡献 优秀版主 论坛元老

9#
发表于 2016-4-11 18:33:24 |只看该作者
云龙神3 发表于 2016-4-11 14:38
下都下不下来

已经更新下载文件
回复

使用道具 举报

0

主题

1

听众

32

积分

设计初学者

Rank: 1

纳金币
5
精华
0
10#
发表于 2016-5-6 10:10:40 |只看该作者
不错不错  哈哈哈和
回复

使用道具 举报

123 第1页 | 共3 页下一页
返回列表 发新帖
您需要登录后才可以回帖 登录 | 立即注册

关闭

站长推荐上一条 /1 下一条

手机版|纳金网 ( 闽ICP备08008928号

GMT+8, 2024-4-25 14:57 , Processed in 0.434507 second(s), 35 queries .

Powered by Discuz!-创意设计 X2.5

© 2008-2019 Narkii Inc.

回顶部