在iphone上顯示手機幀數可建立一個指令碼。具體如下:
//建立一個js指令碼,然後寫好後加入到GUItext裡var updateInterval = 0.5;private var accum = 0.0; // FPS accumulated over the intervalprivate var frames = 0; // Frames drawn over the intervalprivate var timeleft : float; // Left time for current intervalfunction 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 intervalif( timeleft <= 0.0 ){// display two fractional digits (f2 format)guiText.text = "" + (accum/frames).ToString("f2");timeleft = updateInterval;accum = 0.0;frames = 0;}}
在iphone上顯示手機幀數可建立一個指令碼。具體如下:
//建立一個js指令碼,然後寫好後加入到GUItext裡var updateInterval = 0.5;private var accum = 0.0; // FPS accumulated over the intervalprivate var frames = 0; // Frames drawn over the intervalprivate var timeleft : float; // Left time for current intervalfunction 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 intervalif( timeleft <= 0.0 ){// display two fractional digits (f2 format)guiText.text = "" + (accum/frames).ToString("f2");timeleft = updateInterval;accum = 0.0;frames = 0;}}