- Home /
Noticeable difference between full-screen / windowed physics behavior in standalone build
In our game you fall at a constant rate. We apply gravity ourselves:
static float gravityMultiplier = 0.05125f;//magic number
void FixedUpdate () {
RigidBody.MovePosition (
RigidBody.position +
(Vector3.down * Time.deltaTime * gravityMultiplier));
}
In full-screen mode this results in perfectly smooth motion whether vsync is enabled or not. In windowed mode with vsync you also get smooth motion.
In windowed mode WITHOUT vsync it's jerky. The character randomly falls at a slower rate for several seconds, then at a much faster rate for a moment, then a slower rate, etc. - the motion is totally unpredictable.
Unity suggests using FixedUpdate for rigidbodies and Time.deltaTime (which returns fixedDeltaTime in FixedUpdate) and I'm doing both. http://docs.unity3d.com/ScriptReference/MonoBehaviour.FixedUpdate.html http://docs.unity3d.com/ScriptReference/Time-deltaTime.html
At the moment we're forcing vsync on in windowed mode, but this obviously isn't an ideal solution.
How would you suggest fixing this WITHOUT resorting to vsync?
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Game starts stuttering over time 0 Answers
When exactly is OnStateUpdate called for different AnimatorUpdateMode-s? 1 Answer
Physics different in build 1 Answer
Unity4 standalone build problem....Help! 0 Answers