Question by
s21t · Jul 10, 2017 at 05:54 PM ·
indexoutofrangeexception
problem with index out of bounds
please help im trying to make start minu for mobile app but wont work
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement;
public class settingsscript : MonoBehaviour {
// Use this for initialization
void Start () {
Touch other = Input.GetTouch(0);
Touch[] myTouches = Input.touches;
for(int i = 0; i < Input.touchCount; i++);
{
SceneManager.LoadScene("settings", LoadSceneMode.Additive);
}
}
// Update is called once per frame
void Update () {
}
}
Comment
The error should tell you which line it happens on. I'm suspecting
Touch other = Input.GetTouch(0);
If you don't have touches when Start is called, you can't get the first touch.