When I run an empty project with this script attached to the main camera, the lag counter increments. The fixed one does not. I have a quadcore, so I'd say the processing power should be sufficient.
var currTime : float;
var lag : int;
var currFixedTime : float;
var fixedLag : int;
function Start()
{
Time.fixedDeltaTime=0.05;
while(true)
{
if (Time.time-currTime>0.1)
lag +=1;
currTime = Time.time;
yield WaitForSeconds(0.05);
}
}
function FixedUpdate()
{
if (Time.time - currFixedTime > 0.1)
fixedLag +=1;
currFixedTime = Time.time;
}
function OnGUI()
{
GUILayout.Label("Time: " + currTime);
GUILayout.Label("Lag: " + lag);
GUILayout.Label("Fixed: " + fixedLag);
}
I assume I get the lags because WaitForSeconds is somehow tied into the framerate. How can I get the behaviour I'm getting from FixedUpdate, without using FixedUpdate? (Still want my physics to be calculated 50 times per second)
-Bonus Question:
Are NetworkViews synchronization lagging in the same way as the WaitForSeconds?