void AddTouchpoint(Vector2 pos, int id, int root) { if (!touchPoints.ContainsKey(id)) { TouchPoint touchPoint = new TouchPoint(pos, id); GameObject touchObject = Instantiate(touchPointPrefab); touchObject.name = id.ToString(); touchObject.transform.SetParent(transform); touchObject.transform.localPosition = pos; string text = id.ToString(); touchObject.GetComponentInChildren <UnityEngine.UI.Text>().text = text; touchPoint.SetGameObject(touchObject); touchPoint.SetRootID(root); touchPoints.Add(id, touchPoint); } }