topical media & game development

talk show tell print

lib-unity-example-procedural-Assets-Sources-~ControlScripts-VPS.js / js



  private var mesh :  Mesh;
  var showFPS = false;
  
  function Start ()
  {
          guiText.material.color = Color.black;
  }
  
  function LateUpdate () {
          if (!mesh)
                  mesh = FindObjectOfType (Mesh);
          
          if (Time.frameCount % 5) {
                  var vps : int = (mesh.vertexCount / Time.smoothDeltaTime) / 1000;
                  guiText.text = "Vertices per second:\n" + vps + "k";
                  
                  var fps : int = (1.0 / Time.smoothDeltaTime);
                  if (showFPS)
                          guiText.text += "\nFrames per second:\n" + fps;
          }
  }


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.