Hey guys,
My accelerometer input works fine when I run my game through Unity remote, but doesn't work when I build it through XCode and run it on my iPhone that way.
Here is my code, any help is highly appreciated!
if (ButtonPositions.UsingAccelerometer)
{
moveX = 0;
iPx = Input.acceleration.x;
if (Mathf.Abs(iPx) > 0.2f)
{
moveX = Mathf.Sign(iPx);
if (moveX > 0)
{
MoveRight();
}
else if (moveX < 0)
{
MoveLeft();
}
}
else
{
myTransform.rigidbody2D.velocity = new Vector2(0, myTransform.rigidbody2D.velocity.y);
}
if (Input.touchCount > 0)
{
Jump();
}
}
Thanks!!
↧