I have several game objects with the same components. This component adds forces to the rigidbody in FixedUpdate. Furthermore, other parts of the program not in FixedUpdate might add forces to the rigidbody.
Before the physics update runs, I want to validate the forces. Is there some kind of callback I can use? Something like OnPrePhysicsUpdate?
Furthermore, I need this script to be reusable. Ideally, it should work immediately after attaching the component. No other work required or subtleties to remember.
For example, Peter G’s post to this question explains how to use events to get a callback just before the physics update. However, this method requires the programmer to register event handlers instead of using FixedUpdate. This is counterproductive because if I add this script to an old project, then I have to change any script that uses FixedUpdate to register an event handler.