Quantcast
Channel: Questions in topic: "android sdk"
Viewing all articles
Browse latest Browse all 455

Why am I getting this error message?

$
0
0
I'm getting this message in the unity console window: ArgumentException: Index out of bounds. UnityEngine.Input.GetTouch (Int32 index) (at C:/buildslave/unity/build/artifacts/generated/common/runtime/InputBindings.gen.cs:619) TouchTest2.Update () (at Assets/TouchTest2.cs:18) This is my code in Microsoft visual studio: using System.Collections; using System.Collections.Generic; using UnityEngine; public class TouchTest2 : MonoBehaviour { Ray ray; // Use this for initialization void Start() { } // Update is called once per frame void Update() { if (Input.touchCount > 0 || Input.GetTouch(0).phase == TouchPhase.Began) { ray = Camera.main.ScreenPointToRay(Input.GetTouch(0).position); Debug.DrawRay(ray.origin, ray.direction * 20); if (Physics.Raycast(ray, Mathf.Infinity)) { Debug.Log("Hit Something"); } } } }

Viewing all articles
Browse latest Browse all 455

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>