Using Scan, ScanLoop - the idea is to move Scan to its own thread. Is this possible


I have a question about moving Scan to its own thread. I have read the following threads which are “older” so I am curious if anything has changed since:

So, in the end, I need to the performance of Scan to be improved, which I tried to solve placing it into its own thread. However, that ran into an error as confirmed in the first link above.

My question is if there has been improvement to this since the dates of those threads. Is there some recommendations on implementing a more smooth use of Scan or ScanLoop, etc…?

Thanks in advance!


Grid graphs (which you use) cannot be calculated in a separate thread because they use the unity physics engine for a lot of things, and that can unfortunately not be accessed from a separate thread. It is possible that the new unity job scheduler will be able to improve on this, but currently it is not possible.

You can however scan the graph over several frames using the ScanAsync method (which has superseded the ScanLoop function). It does not guarantee a good frame rate though, but it will be better.
Another approach you could take is to issue many smaller graph updates to recalculate only a part of the graph for every frame (for this I would strongly recommend to use the latest beta though, due to some optimizations done in that when making small updates to large graphs).

1 Like

Thanks Aron,

I will try the ScanAsync and work around any other perf issues.