Hi all,
I’m sure this has been answered before but the following code causes my android app to hang:
#if UNITY_ANDROID
int i = 0;
while (i < Input.touchCount)
{
if (Input.GetTouch(i).phase == TouchPhase.Began || Input.GetTouch(i).phase == TouchPhase.Stationary)
{
PlayerPrefs.SetInt(“scene”, 1);
PlayerPrefs.Save();
Application.LoadLevel(1);
}
++i;
}
#endif
It works fine in the editor when I run the same code for a key input and when I remove these lines
PlayerPrefs.SetInt(“scene”, 1);
PlayerPrefs.Save();
it works fine.
I don’t know whether its a permissions problem but there’s nothing in the docs to say it shouldn’t be called like this and its a bit of a headache really.
Thanks