I'm using jobs (this time without ECS) to do some physics calculations in FixedUpdate. In the docs it is mentioned that it's good practice to schedule jobs in Update and then complete them in LateUpdate so they have time to run. I'd like to do that in a MonoBehaviour, but with FixedUpdate. Is there something like LateFixedUpdate?
I don't think it exists. you can: a) have 2 related MonoBehaviour and use script execution order to schedule them (one early, the other late) b) keep the job handle around, in your FixedUpdate() you .Complete() the previous frame job before scheduling the job for the current frame (you get 1 frame lag). remember to call JobHandle.ScheduleBatchedJobs(), else the jobs only gets scheduled when you .Complete() them
@any_user What @M_R is suggesting makes total sense, and it's likely the best approach in your situation. That said, you should be able to implement your own LateFixedUpdate logic via the new experimental API that we exposed, that allow you to customize the player loop from managed code (https://docs.unity3d.com/2018.1/Documentation/ScriptReference/Experimental.LowLevel.PlayerLoop.html). Depending on your needs, you can inject a new PlayerLoopSystem at the end of the fixed update sub group, and drive your logic from there. The documentation of the feature is not amazing (yet) but you can look at the ECS source code to get an idea of how to use the API.