public void StartDrag(GameObject card) { LastContainer = card.transform.GetComponentInParent <GridContainer>(); //LastContainer = card.transform.parent.parent.parent.GetComponent<GridContainer>(); LastIndex = LastContainer.GetCardIndex(card); card.transform.SetParent(GetComponentInParent <Canvas>().gameObject.transform); }