File tree Expand file tree Collapse file tree 2 files changed +23
-5
lines changed Expand file tree Collapse file tree 2 files changed +23
-5
lines changed Original file line number Diff line number Diff line change 13
13
14
14
namespace FbxExporters . Review
15
15
{
16
- [ CustomEditor ( typeof ( RotateModel ) ) ]
16
+ [ CustomEditor ( typeof ( FbxTurnTableBase ) ) ]
17
17
public class EditorRotate : UnityEditor . Editor
18
18
{
19
- RotateModel model ;
19
+ FbxTurnTableBase model ;
20
20
21
21
public void OnEnable ( )
22
22
{
23
- model = ( RotateModel ) target ;
23
+ model = ( FbxTurnTableBase ) target ;
24
24
EditorApplication . update += Update ;
25
25
}
26
26
Original file line number Diff line number Diff line change @@ -18,9 +18,27 @@ public class FbxTurnTableBase : MonoBehaviour
18
18
[ SerializeField ]
19
19
private float speed = 10f ;
20
20
21
- void Update ( )
21
+ #if UNITY_EDITOR
22
+ private float timeOfLastUpdate = float . MaxValue ;
23
+ #endif
24
+
25
+ public void Rotate ( )
22
26
{
23
- transform . Rotate ( Vector3 . up , speed * Time . deltaTime , Space . World ) ;
27
+ float deltaTime = 0 ;
28
+ #if UNITY_EDITOR
29
+ deltaTime = Time . realtimeSinceStartup - timeOfLastUpdate ;
30
+ if ( deltaTime <= 0 ) {
31
+ deltaTime = 0.001f ;
32
+ }
33
+ timeOfLastUpdate = Time . realtimeSinceStartup ;
34
+ #else
35
+ deltaTime = Time . deltaTime ;
36
+ #endif
37
+ transform . Rotate ( Vector3 . up , speed * deltaTime , Space . World ) ;
38
+ }
39
+
40
+ void Update ( ) {
41
+ Rotate ( ) ;
24
42
}
25
43
}
26
44
}
You can’t perform that action at this time.
0 commit comments