Hi, I'm pretty new to unity, but I've learned a good amount from online videos. What I'm wondering is that every time I fix all the listed errors about a 100 more re-appear. Is there a way to automatically fix all errors?
moved from answer
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 two fractional digits (f2 format)
guiText.text = "" + (accum/frames).ToString("f2");
timeleft = updateInterval;
accum = 0.0;
frames = 0;
}
}
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
i would suggest to start the class from 0, to see if the code is the one with the error, and not other class, when you have lots of errors, most common cause, is a missing '}' or a ')', some of this things, also check for the ';', have fun coding