Skip to content

Commit 7deebba

Browse files
committed
keep track of delta time in editor
1 parent e812bce commit 7deebba

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

Assets/FbxExporters/RotateModel.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,29 @@ public class RotateModel : MonoBehaviour
1818
[SerializeField]
1919
private float speed = 10f;
2020

21+
#if UNITY_EDITOR
22+
private float timeOfLastUpdate = float.MaxValue;
23+
#endif
24+
25+
private float deltaTime = 0;
26+
2127
public float GetSpeed()
2228
{
2329
return speed;
2430
}
2531

2632
public void Rotate()
2733
{
28-
transform.Rotate (Vector3.up, speed * Time.deltaTime, Space.World);
34+
#if UNITY_EDITOR
35+
deltaTime = Time.realtimeSinceStartup - timeOfLastUpdate;
36+
if(deltaTime <= 0){
37+
deltaTime = 0.001f;
38+
}
39+
timeOfLastUpdate = Time.realtimeSinceStartup;
40+
#else
41+
deltaTime = Time.deltaTime;
42+
#endif
43+
transform.Rotate (Vector3.up, speed * deltaTime, Space.World);
2944
}
3045

3146
void Update ()

0 commit comments

Comments
 (0)