Beispiel #1
0
    // The shown FPS will be 0 for the first second until it ticks over correctly
    public override void Update()
    {
        // measure average frames per second
        fpsAccumulator++;
        if (Time.realtimeSinceStartup > fpsNextPeriod)
        {
            currentFps     = (int)(fpsAccumulator / FPSMeasurePeriod);
            fpsAccumulator = 0;

            fpsNextPeriod += FPSMeasurePeriod;

            // Colour Changing
            if (currentFps > 55)
            {
                // A good area to be at
                component.ChangeText(string.Format(GreenDisplay, currentFps));
            }
            else if (currentFps >= 30 && currentFps <= 55)
            {
                // Less preferable but playable
                component.ChangeText(string.Format(YellowDisplay, currentFps));
            }
            else
            {
                // Too low, most likely due to an error or major slowdown
                component.ChangeText(string.Format(RedDisplay, currentFps));
            }
        }
    }
    public override void Start(BasePerformanceComponentUI componentUI)
    {
        component = (TextPerformanceComponentUI)componentUI;

        fpsFinishPeriod = Time.realtimeSinceStartup + FPSMeasurePeriod;

        component.ChangeText("Avg: ...");
    }
    // The shown FPS will be 0 for the first second until it ticks over correctly
    public override void Update()
    {
        // measure average frames per second
        fpsAccumulator++;
        if (Time.realtimeSinceStartup > fpsFinishPeriod)
        {
            currentFps = (int)(fpsAccumulator / FPSMeasurePeriod);

            fpsAccumulator = 0;

            fpsFinishPeriod += FPSMeasurePeriod;

            component.ChangeText(string.Format(Display, currentFps));
        }
    }
    // The shown FPS will be 0 for the first second until it ticks over correctly
    public override void Update()
    {
        // measure average frames per second
        fpsAccumulator++;
        if (Time.realtimeSinceStartup > fpsNextPeriod)
        {
            currentFps     = (int)(fpsAccumulator / FPSMeasurePeriod);
            fpsAccumulator = 0;

            fpsNextPeriod += FPSMeasurePeriod;

            if (currentFps < lowestFps)
            {
                lowestFps = currentFps;
            }
            else if (currentFps > highestFps)
            {
                highestFps = currentFps;
            }

            component.ChangeText(string.Format(Display, lowestFps, highestFps));
        }
    }
 public override void Update()
 {
     component.ChangeText("0ms");
 }
 public override void Update()
 {
     component.ChangeText("Mem: " + ((Profiler.GetTotalReservedMemory() / 1024) / 1024) + "mb\nAlloc: " + ((Profiler.GetTotalAllocatedMemory() / 1024) / 1024) + "mb");
 }