- Home /
Object is moving slower on other device (Android)
Hello everyone, Tudor here, I am developing a game. On my phone (Android) the "Cube" is moving normal. But on my tablet it moves a lot slower. Why? using UnityEngine; using System.Collections;
public class AndroidControlDown : MonoBehaviour {
public GameObject Cube;
private Vector3 input; //For rigidbody.AddForce
// Update is called once per frame
void Update ()
{
if(Input.touchCount > 0)
{
if(guiTexture.HitTest(Input.GetTouch(0).position))
{
input = new Vector3(0, 0, -55);
Cube.rigidbody.AddForce(input);
}
}
}
}
That's, for example, the code for the down button. Can someone please help me? Should I use FixedUpdate()?
Answer by GameVortex · Jan 21, 2015 at 03:29 PM
That is because Update is called once per frame and the framerate will be different depending on the device. This is why you have do all physics stuff from the FixedUpdate function which is called at a consistent rate. You will still need to save input in the Update function though as Input does not work from the FixedUpdate.
Your answer
Follow this Question
Related Questions
How do I make this kind of follow script? 1 Answer
Rigidbody doesn't move on moving platform 4 Answers
Simulator physics - how to get objects to "stick" to each other 0 Answers
Rigidbodies won't collide if mass difference is too high 0 Answers
Bonding rigidbodies, then making them seperate when they get exploded 1 Answer