Unity: Move object at same rate across platforms
Date: 2020-05-25 | crossplatform | framerate | unity |
DISCLOSURE: If you buy through affiliate links, I may earn a small commission. (disclosures)
problem
I was building a mobile game, coffeedash, and found that when I played my game on an actual mobile device, my character moved a lot slower than it did when I ran the Unity game on my computer.
solution
The problem was that I was moving my object in the Update
function. The Unity Update
function is called once per frame and you can imagine that the frame rate of a mobile device is likely a lot lower than the frame rate of, say, a gaming computer.
To fix this, you can use the FixedUpdate
function which gets called 50 times / second regardless of what device you're playing on.
Want more like this?
The best way to support my work is to like / comment / share for the algorithm and subscribe for future updates.