One of the options is using the Dispatcher pattern. The idea of this pattern is to create an object for each thread you want to invoke on(main thread in your case) which maintains list of delegates that is being polled and executed(e.g. in Update
method). Since there is not implementation in Unity I am aware of, you either need to find Dispatcher implementation for Unity or implement it by yourself.
wondra
- 4.9k
- 1
- 22
- 36