Hello,
I released a game on iOS (everything worked perfectly) and have now released it on Android but I am getting complaints that my player character has laggy input. I can't figure out why this is happening, especially since it worked totally fine on iOS. I found the script below and have been using it for both platforms for my characters controls:
using UnityEngine;
using System.Collections;
public class MoveControls : MonoBehaviour {
public GameObject player;
// Update is called once per frame
void Update ()
{
if(Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Stationary)
{
Vector2 touchPosition = Input.GetTouch(0).position;
double halfScreen = Screen.width / 2.0;
if(touchPosition.x < halfScreen)
{
player.transform.Translate(Vector3.left * 6 * Time.deltaTime);
}
else if(touchPosition.x > halfScreen)
{
player.transform.Translate(Vector3.right * 6 * Time.deltaTime);
}
}
}
}
I did port this from iOS to Android so I don't know if some type of settings may be a problem? And I don't have any errors either. If anyone can point me in the right direction I would be very grateful.
Thanks!
↧