Most of the time when I use FixedUpdate I dont add Time.fixedDeltaTime, but is that something I should do? Because we have Time.deltaTime in Update which is for making sure that your game runs frame independent, right? So it doesn't matter if you have 50 or 500 fps.
But what about Time.fixedDeltaTime in FixedUpdate, are you supposed to use it when moving your objects with their rigidbody?
I created this simple code which moves the rigidbody with AddForce:
[SerializeField] private float _speed; [SerializeField] private Rigidbody2D _rb; [SerializeField] private bool _isUsingfixedDeltaTime; void FixedUpdate() { if(_isUsingfixedDeltaTime) { _rb.AddForce(new Vector2(_speed * Time.fixedDeltaTime, 0)); } else { _rb.AddForce(new Vector2(_speed, 0)); } } It just adds a force to your rigidbody and you can choose between using fixedDeltaTime or not. If I am not wrong fixedDeltaTime gives back how many seconds it takes each time to run FixedUpdate, which is 0.02 seconds. So all we are doing is multiplying speed with 0.02. But what's the point to that if FixedUpdate is always called every 0.02 seconds? Isnt it the same without it? FixedUpdate gets called as many times on a ps with low fps as on a pc with high fps, right?
deltaTimeto make your calculations framerate independent, even when running at a fixed framerate, to avoid creating technical debt where changing that fixed rate down the line would require a massive re-tuning pass. \$\endgroup\$