diff --git a/src/components/stats-plus.js b/src/components/stats-plus.js index c64100eeafa0e069a10ff2b005181a2dc446435e..2c4c148001c65cb2523bfa564024615a402392a8 100644 --- a/src/components/stats-plus.js +++ b/src/components/stats-plus.js @@ -53,6 +53,7 @@ AFRAME.registerComponent("stats-plus", { this.fpsEl.classList.add("rs-fps-counter"); document.body.appendChild(this.fpsEl); this.lastFpsUpdate = performance.now(); + this.lastFps = 0; this.frameCount = 0; if (scene.isMobile) { @@ -88,8 +89,11 @@ AFRAME.registerComponent("stats-plus", { // Update the fps counter text once a second if (now >= this.lastFpsUpdate + 1000) { - const fps = this.frameCount / ((now - this.lastFpsUpdate) / 1000); - this.fpsEl.innerHTML = Math.round(fps) + " FPS"; + const fps = Math.round(this.frameCount / ((now - this.lastFpsUpdate) / 1000)); + if (fps !== this.lastFps) { + this.fpsEl.innerHTML = Math.round(fps) + " FPS"; + this.lastFps = fps; + } this.lastFpsUpdate = now; this.frameCount = 0; }