Add an FPS counter to Unity8 for yourself



  • Just logging something for posterity, maybe someone will find it useful.

    You can add this to the end of Unity8's Shell.qml, but before the final closing brace, to get a (somewhat accurate) FPS counter:

    
        Label {
            id: fpsCounter
            property real t
            property int frame: 0
            color: "red"
            text: "? Hz"
            z: 9999
            textSize: Label.XLarge
    
            anchors {
                top: parent.top
                left: parent.left
            }
    
            Timer {
                id: fpsTimer
                property real fps: 0
                repeat: true
                interval: 1000
                running: true
                onTriggered: {
                    parent.text = "FPS: " + fpsTimer.fps + " Hz"
                    fps = fpsCounter.frame
                    fpsCounter.frame = 0
                }
            }
    
            NumberAnimation on t {
                id: tAnim
                from: 0
                to: 100
                loops: Animation.Infinite
            }
    
            onTChanged: {
                update() // force continuous animation
                ++frame
            }
        }
    

    I'm not interested in making this a "feature" per se, but it's useful for testing if you like.

    Please don't do this on your device, it will get in the way and cause a bunch of CPU and GPU load.



  • I'm interested with the results of each device. So far, in my experience, Nexus 5 is much smoother than bq E5 and MX4. I migh try this one of these days 😄


Log in to reply