Пример #1
0
    void Update()
    {
        framesCount++;

        /* new tick? recount */
        float time       = Time.realtimeSinceStartup;
        float timePassed = time - lastTime;

        if (timePassed >= updateInterval)
        {
            /* increment/update */
            ticksTotal++;
            frameTime    = (time - lastTime) / framesCount;
            frameTimeMax = Mathf.Max(frameTimeMax, frameTime);
            timeTotal   += timePassed;
            framesTotal += framesCount;
            //#if !FPS_COUNTER_MINIMAL
            memory     = NativeUtils.GetCurrentMemoryBytes();
            memory    /= 1024;
            memoryMax  = memory > memoryMax? memory: memoryMax;
            memorySum += memory;
            //#endif

            /* reset tick counter */
            lastTime    = time;
            framesCount = 0;

            /* update fps/etc and debug info */
                        #if !FPS_COUNTER_MINIMAL
            UpdateTexts(showFullFpsInfo);
                        #endif
        }
    }
Пример #2
0
    void Update()
    {
        _frameCount += 1;

        float currentTime = Time.realtimeSinceStartup;

        if (currentTime > _lastFPSTime + UpdateInterval)
        {
            _fps         = (int)(_frameCount / (currentTime - _lastFPSTime));
            _lastFPSTime = currentTime;
            _frameCount  = 0;

            _curMemory = (NativeUtils.GetCurrentMemoryBytes() >> 20);
        }

        if (_screenHeight != Screen.height || _screenWidth != Screen.width)
        {
            CalculateRect();
        }
    }
Пример #3
0
    void Update()
    {
        _frameCount += 1;

        float currentTime = Time.realtimeSinceStartup;

        if (currentTime > _lastFPSTime + UpdateInterval)
        {
            _fps = (int)(_frameCount / (currentTime - _lastFPSTime));

            if (_lowFps > _fps)
            {
                _lowFps = _fps;
            }
            _lastFPSTime = currentTime;
            _frameCount  = 0;

            _curMemory = (NativeUtils.GetCurrentMemoryBytes() >> 20);
        }
    }