Welcome to Unity Learning, unity training, Unity Enterprise training and education zone, there are many u3d resources, u3d training videos, u3d tutorials, U3d Frequently asked questions, U3d Project source code, we are committed to creating the industry Unity3d training, learning the first brand.
1. First create a new JS script in the project, double-click the script to edit, the code is as follows
var updateinterval = 0.5;
private var accum = 0.0; FPS accumulated over the interval
private var frames = 0; Frames drawn over the interval
private Var timeleft:float; Left time for current interval
function Start ()
{
if (!guitext)
{
Print ("Framespersecond needs a guitext component!");
Enabled = FALSE;
Return
}
Timeleft = UpdateInterval;
}
function Update ()
{
Timeleft-= Time.deltatime;
Accum + = Time.timescale/time.deltatime;
++frames;
Interval ended-update GUI text and start new Interval
if (timeleft <= 0.0)
{
Display fractional digits (F2 format)
Guitext.text = "" + (Accum/frames). ToString ("F2");
Timeleft = UpdateInterval;
Accum = 0.0;
frames = 0;
}
}
2. Add to Guitext after writing
For more highlights, please click http://www.gopedu.com/
How do i show the current number of games running frames in unity?