Corgi Async Raycasts allow you to easily leverage Unity’s built in Jobified raycasts system. It provides an extremely simple to use API for moving your raycasts off of the main thread.
Can you post profiler results? getting 5 fps with 50,000 cubes… you might just be bottlenecked by cube rendering lol. Also, as the documentation suggests you should avoid that API in particular, use the one that gives tickets and it’ll be faster overall
It’s neat but I’m not getting performance increase (at least in editor).
Seems like overhead for scheduling gives worse performance.
10000 raycasts
default unity ~55ms main thread 17fps
raycast tickets ~65ms main thread 15fps
async callbacks ~80ms main thread 12fps
Nonetheless, I wanted to try jobified raycasts, and this is a good performance test.
Would you mind repeating your test in a build? I’ve been using this plugin in real projects and have only had gains from it. Profiling within the editor is often misleading.
Edit: I wanted to comment on some of the performance comments above in the thread. The demo scene included IS the performance test scene, by the way. You can toggle the raycast mode and see the difference. Even in the editor, it should be significant. If you have a use-case that doesn’t get better performance, please explain it here and I can try and help.
You can see that yes, there is overhead for scheduling, but the overall time should be much smaller. (The jobs are happening in the job threads at the bottom).