The above code is part of a script that handles the player character turning in my game. On some computers, this works perfectly. On others, the program for some reason decides that, even though turnSensitivity and Time.deltaTime are both positive, turnSensitivity45Time.deltaTime = 0. I cannot figure out why, and there seems to be no pattern whatsoever to what machines it occurs on. I tested it on two exactly identical macs and it worked fine on one and not at all on the other. Incidentally, I am using Unity 3.5.3 as a result of some problems that occur when I try to upgrade to Unity 4. Does anyone have any idea what is going on? Please help!
Time.deltaTime could maybe become zero if Time.timeScale is zero, or if the machine runs without VSync and without a sensible frame rate (deltaTime would be very small and could be rounded down to zero).
What you said about VSync might very well be the problem as I have already confirmed that all the variables being multiplied have the values I expect. That would explain the variation over several machines. Sadly, I am extremely inexperienced and have no idea how to act on your advice. Any further guidance would be very much appreciated! Thanks!
Wait, I just remembered that I use Time.deltaTime in other places in the same script, and it works fine in those cases. That would seem to indicate that the frame rate is not the issue.
Please don't guess. Find out the actual values. Do debugging, or do Debug.Logs. Otherwise you are spending effort to solve a problem that might not be a problem at all. For example, do you know for a fact that Input.GetAxis("Turning") is returning anything other than 0? Maybe there is a input mapping issue? Once you know what actually is going wrong, address that single thing.
As I already stated above, I have been continuously displaying Input.GetAxis("Turning"), turnSensitivity, and Time.deltaTime one the screen as the game is running. All these have the values expected on all devices I have run the game on.
Is turnX declared as a float or as an int ?
– KiraSenseiturnX is a float.
– ozoneDid you attach the debugger or print some logs on computers where it does not work ?
– KiraSenseiIs it perhaps an input issue? When you initialise turnX, set it to something weird like 123.4 and see if that's what comes out the other end.
– meat5000Do you have the Input axis "Turning" defined on both installations of Unity?
– Jamora