- Home /
Unity Remote works, but the apk don´t
Hi guys, i´m new at unity mobile. I´m trying to make a marble game for android using the accelerometer. Testing the game with android remote, it works fine. But the build apk the accelerometer does not work. Am i missing something??
What do you mean "doesn't work?" explain what happens.
Sometimes there are problems with upgrading using AP$$anonymous$$s. Try uninstalling the application from the device, then copy the AP$$anonymous$$ (make sure it's the same build you have in the editor), reinstall it and test.
Thanks. The ball is moving but not properly. When it should go down, it goes left;
When it should go up, goes right;
When it should go right, goes down;
When it should go left, goes up;
And it happens only on build. the editor the ball goes to the right direction.
this is my code:
void Start ()
{
circ = 2 * $$anonymous$$athf.PI * collider.bounds.extents.x;
previousPosition = transform.position;
}
// Update is called once per frame
void Update ()
{
// $$anonymous$$ovimento da bola
//Vector3 movement = (Input.GetAxis("Horizontal") * Vector3.right * movementSpeed) +
// (Input.GetAxis("Vertical") * Vector3.forward * movementSpeed);
// Aplicando fisica na bola, para tornar o movimento mais real.
//rigidbody.AddForce(movement, Force$$anonymous$$ode.Force);
//Android Test Certo
tilt.x = Input.acceleration.y;
tilt.z = -Input.acceleration.x;
rigidbody.AddForce(tilt * movementSpeed * Time.deltaTime);
}
void LateUpdate()
{
Vector3 movement = transform.position - previousPosition;
movement = new Vector3(movement.z, 0, -movement.x);
transform.Rotate(movement / circ * 360, Space.World);
previousPosition = transform.position;
}
Your answer
Follow this Question
Related Questions
Input Acceleration Z always -1 0 Answers
Problems installing apk built from Android Studio 1 Answer
unity to android 1 Answer
Android Z Axis 0 Answers
Sending email via APK version 1 Answer