Raycasting at regular intervals with a frequency above the framerate.
For the project I'm working on, I need to batch of raycasts about 200 times/second, ideally at as regular of an interval as possible, but I don't need the frame rate to be that high (and to not use more resources than I have to, I would rather not).
The reason I need to raycast so often isn't algorithmic, but because the game made in unity is used to control a peripheral device which can respond at up to ~200hz, so this isn't something one can get around by making a smarter algorithm. The hope is to get as close to this limit as possible.
To my understanding, a coroutine isn't suitable for this purpose (since it runs on the main thread and only once per frame), and neither is FixedUpdate
(I recall reading about how it doesn't necessarily execute in a regular interval somewhere).
Finally there's the jobs system. I was hoping I could simply schedule jobs from another job which wouldn't run on the main thread (and thus, I could put to sleep or something of the sort, until it's time for the next batch of raycasts) and would be responsible for scheduling the other jobs at regular intervals.
But that's not possible (that is, you cannot schedule a job from within another job).
So, how can I schedule something to run at a regular interval at a rate above the framerate? (assume we can guarantee it will run fast enough to do 200 batches per second. Once I know how I can get this done I can probably also figure out how to check if it's not happening fast enough and skip some batches)