MEC Threaded
Trinary Software
$11.00
Date |
Price |
---|---|
日時 |
価格($) |
03/17(2018) |
11.0 |
11/24(2024) |
11.0 |
Jump AssetStore
This package is an upgrade for More Effective Coroutines that allows you to switch back and forth between the main thread and external threads using the same yield return syntax you are used to.
Most of the things you can do in Unity are best done using coroutines. However, there are a couple of things that are better done using threads.
Some things you can do in a separate thread
- Saving or disk access of any kind without causing frame rate jitters.
- Doing intense number crunching, like AI decisions or A* pathing without effecting the frame rate.
- Swarming or moving a large number of small objects according to independent logic.
Some things you cannot do in a separate thread
- You cannot read or write the values of anything in your scene. This includes gameObjects, transforms, buttons, gui text components, etc.
- You cannot query the Random class for a random number.
This module gets around the limitations of threads by allowing you to write a coroutine that gathers all the data it needs and then switches to a separate thread to act on that data. Threads are automatically pooled and a lot of the messiness of threads is avoided.
This package uses MEC, and comes with the free version included. This package is also designed to work with MEC Pro. If you have Pro just replace the MEC free files with those from pro.
Question: How does threading compare to ECS?
Answer: ECS will perform better than threading in all cases. In a lot of cases it will perform A LOT better. This is not because this, or any other, threading framework is slow. It's due to the fact that threading is used by ECS automatically, along with a bunch of other optimizations that further increase performance.
However, most people will find this threading framework to be a lot easier to use than ECS, and this framework is still an excellent way to implement saving your game without causing a frame rate hitch.