UNT0005 Time.deltaTime used with FixedUpdate
March 6, 2020 ยท View on GitHub
This rule is now disabled by default, see why here. if you still want to use it, you can add the following to your .editorconfig file:
[*.cs]
dotnet_diagnostic.UNT0005.severity = suggestion
FixedUpdate is independent of the frame rate. Use Time.fixedDeltaTime instead of Time.deltaTime.
Examples of patterns that are flagged by this analyzer
using UnityEngine;
class Camera : MonoBehaviour
{
public void FixedUpdate()
{
var foo = Time.deltaTime;
}
}
Solution
Use Time.fixedDeltaTime:
using UnityEngine;
class Camera : MonoBehaviour
{
public void FixedUpdate()
{
var foo = Time.fixedDeltaTime;
}
}
A code fix is offered for this diagnostic to automatically apply this change.