In my game, if a user holds down the left mouse button, a jetpack will rise in the air with flames ignited. This thrust actively works against gravity. When the thrust turns off, the flames will go out and gravity will cause the jetpack to fall.
This works perfectly in Unity. On my iPhone, however, the jetpack will not lift off the ground. Instead is stutters on the ground when the screen is being touched. The flames, however, do show and hide correctly when the screen is being touched / not touched, therefore I know it is reading the input correctly. Perhaps there seems to be an issue with the physics that only happens on the phone?
Does anyone have any ideas? Thanks!
void Update () {
if (Input.GetMouseButton (0)) {
// Show flames
thrustObject.SetActive(true);
// Force that works when using the mouse, but not when on my iPhone screen
rb.AddForce (new Vector2 (0, thrust), ForceMode2D.Impulse);
} else if (Input.GetMouseButtonUp(0)) {
// Hide flames
thrustObject.SetActive(false);
}
}