I have the following snippet of code used to toggle between two scenes based on the value of the z-axis. 0.0 to -0.5 for one screen and -0.9 to -1.0 for the other screen. The code works as expected when in debug mode thru the remote so I know the values of my tests are accurate for what I want. However, when I build to the device and run, it goes haywire. It inconsistently toggles when I tilt the device and when it does toggle, it does so correctly, but maybe only about 30 to 40% of the attempted toggles.
public float Bind1;
public float Bind2;
public string screen;
void Update(){
if(Input.acceleration.z >= Bind1 && Input.acceleration.z <= Bind2)
{
Application.LoadLevel(screen);
}
}
I did try using deviceOrientation first but got nowhere with that. It would return unknown when I looked at it's readings in debug mode. Not that it should matter since the test I posted here seems accurate for what I want.
I appreciate any help offered and want to say thanks in advance!
↧