Hello, I finished a mobile game where I use the phone’s accelerometer to move the player. I found a solution to detect the phone start position to begin playing & it works fine when I build & run to test it on an android. But when I build & ran thru Xcode it only works when it is facing flat (landscape mode only). But when I test it thru unity remote it works fine on an iPhone. I’m not sure what to do from here. Here is my movement script.
float accelStartY;
void Start()
{
accelStartY = Input.acceleration.y;
}
void FixedUpdate()
{
transform.Translate(Input.acceleration.x, Input.acceleration.y - accelStartY, 0, Space.World);
}
↧