InvokeRepeating looks very handy, but how reliable is it for things like physics?
I want to add force over a period of time… it would be handy to just use InvokeRepeating, and apply small amounts of force repeatedly, like in fixedUpdate, which it should be reliable enough for the force to be constant. Would I get the same effect with InvokeRepeating? Or it would be affected by the device’s performance?
It’s useless for physics because FixedUpdate itself doesn’t run reliably. It may get called 2-3 times a frame sometimes, and the physics just work with this - it’s a fixed time step. A slow machine and physics are set to 30fps fixed update, it might not make it in time, and have to do it twice to simulate properly (for example).
So only do physics over time in FixedUpdate. If you are doing a physics one off thing you can do that fine in Update (or anywhere) - ie a velocity change for a jump once. Its constant forces or forces over time that need to go in fixedupdate (ideally everything for physics).
Not a performance issue, but one that’s a problem for consistency across different machines.