public void Touching() { if (Input.touchCount > 0) { touchesOld = new GameObject[touchList.Count]; touchList.CopyTo(touchesOld); touchList.Clear(); foreach (Touch touch in Input.touches) { Ray ray = view.ScreenPointToRay(touch.position); if (Physics.Raycast(ray, out hit, touchInputMask)) { GameObject target = hit.transform.gameObject; touchList.Add(target); if (touch.phase == TouchPhase.Began) { TCPatternManager.TouchDown(touchNr, target.name); } if (touch.phase == TouchPhase.Ended) { target.SendMessage("TouchEnded", hit.point, SendMessageOptions.DontRequireReceiver); } if (touch.phase == TouchPhase.Stationary || touch.phase == TouchPhase.Moved) { target.SendMessage("TouchStay", hit.point, SendMessageOptions.DontRequireReceiver); } if (touch.phase == TouchPhase.Canceled) { } } } foreach (GameObject g in touchesOld) { if (!touchList.Contains(g)) { g.SendMessage("TouchStopped", hit.point, SendMessageOptions.DontRequireReceiver); } } } }