コード例 #1
0
 void Awake()
 {
     _deltaTime     = Time.fixedDeltaTime;
     _timeOffset    = 0;
     _frameCount    = 0;
     _pollDeltaTime = () => TimeSpan.FromSeconds(_deltaTime);
 }
コード例 #2
0
    void Awake()
    {
        _lastSampledFrame = -1;
        _stopwatch        = _stopwatch ?? new Stopwatch();
        _pollDeltaTime    = () => TimeSpan.FromSeconds(DeltaTime);

#if UNITY_EDITOR
        // Handles whatever
        UnityEditor.EditorApplication.playmodeStateChanged += () => {
//            UnityEngine.Debug.Log("Clock pausing because editor state changed: " + UnityEditor.EditorApplication.isPaused);
            if (UnityEditor.EditorApplication.isPaused)
            {
                _stopwatch.Stop();
            }
            else
            {
                _stopwatch.Start();
            }
        };
#endif
    }