Touch Manager not accepting GUITexture

This following code is my Unity(C#) Touch Manager Script that simply tells the results of hit test to its children:

public static bool guiTouch = false;

	public void TouchInput (GUITexture texture)
	{
		if (texture.HitTest(Input.GetTouch(0).position))
		{
			switch(Input.GetTouch(0).phase)
			{
				case TouchPhase.Began:
				SendMessage("OnFirstTouchBegan");
				guiTouch = true;
				break;

			case TouchPhase.Stationary:
				SendMessage("OnFirstTouchStayed");
				guiTouch = true;
				break;
				case TouchPhase.Moved:
				SendMessage("OnFirstTouchMoved");
				guiTouch = true;
				break;
				case TouchPhase.Ended:
				SendMessage("OnFirstTouchEnded");
				guiTouch = false;
			break;

		}

I’ve accessed it with the following script:

using UnityEngine;
using System.Collections;

public class SquareTouchedDetector : TouchManager {
	public GUITexture texture;
	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {

		TouchInput (texture);
	}
	void OnFirstTouchBegan ()
	{
		SendMessage ("Tappin' works!!");
	}
}

For some reason after being given the GUITexture it so much desires it gives me this error:
ArgumentException: Index out of bounds.
TouchManager.TouchInput(UnityEngine.GUITexture texture)(at Assets/Scripts/TouchManager.cs:13)

Your help is very much appreciated as I am somewhat knew to Unity C# and am trying to get my first game in the store. Thanks in advance :slight_smile:

This error is because when there are no touches on the screen the index for “GetTouch(*)” is null… flashing this error.
No need to worry however, this is normal and doesn’t change anything or slow your game at all.

-Bud Broesky