Using threads for specific paths

Hi

How would i go about using threads only for specific paths ?

I have custom traversal provider that operates with MonoBehavior components quite heavily for certain paths, those i would need to run in main thread.

All other paths can be threaded. Is this possible or if not, can you point me how i would implement this ?
Thank you

Hi

Sorry, this is not really possible out of the box right now.
If you want to try to implement this, there are a few things you have to do:

  • The PathProcessor constructor needs to be modified to both start a coroutine and start a bunch of threads
  • The Path class needs to be modified, you need to add a boolean specifying if it should execute in the main thread or not. Make sure to also reset this boolean in the Reset method.
  • The ThreadControlQueue.PopNoBlock and Pop and PopNoBlock methods need to be modified so that Pop only pops paths which are for the main thread, and PopNoBlock only pops paths which are for other threads.
  • And probably more, but these are the things that I can think of right now.

Yeah i modified in meanwhile :slight_smile: Thanks for response.