I've been trying to make my card instantiate from a list... but its not working, I'm trying to add it to a canvas and my object is a rect transform. I'm not sure whats going wrong... Code (CSharp): { // Debug.Log("Player has " + player1Hand[i]); Instantiate(player1Hand[i]); player1Hand[i].transform.parent = SpawnPoint.transform; }
you seem to be changing the reference objects transform instead of the instantiated one try this Code (csharp): GameObject go = (GameObject)Instantiate(player1Hand[i]); go.transform.parent = SpawnPoint.transform;
Just checked this and seen it, I figured it out straight after I posted. Thanks though! I did this. Code (csharp): public RectTransform SpawnPoint; // use this to stop yellow error. GameObject go = (GameObject)Instantiate(player1Hand[i]); go.transform.SetParent(SpawnPoint.transform);