- Home /
This question was
closed Jan 31, 2015 at 01:41 AM by
meat5000 for the following reason:
The question is answered, right answer was accepted
Question by
danielmetlitski · Jan 30, 2015 at 07:20 PM ·
iosiphonexcodeaccelerometertilting
Accelerometer input working in Unity Remote, not working in build.
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!!
Comment
Best Answer
Answer by danielmetlitski · Jan 30, 2015 at 11:26 PM
Hey guys, I have found an answer.
In my Player Settings, I disabled the accelerometer frequency! So I set it to 60 mhz, and it worked!