Question by 
               jasonhutton · Jun 10, 2018 at 02:40 AM · 
                instantiateprefabunityeditorstartfor-loop  
              
 
              Having problem with instantiated prefabs
I have a card prefab attached to my CardManager. I then want to create the deck like so:
  private void buildMainDeck()
         {
             int order = 1;
             for (int i = 0; i < this.baseGameCardType1Count; i++)
             {
                 Card newCard = Instantiate(card, this.transform);
                 newCard.cardData = cardDataList[17];
                 newCard.GetComponent<Canvas>().sortingOrder = order;
                 order++;
             }
             for (int i = 0; i < this.baseGameCardType2Count; i++)
             {
                 Card newCard = Instantiate(card, this.transform);
                 newCard.cardData = cardDataList[18];
                 newCard.GetComponent<Canvas>().sortingOrder = order;
                 order++;
             }
     //etc
     }
In the cards I have the following for Start:
  void Start()
         {
             Debug.Log(cardData.cardFaceImage.ToString());
             Debug.Log(cardData.cardTitle);
             faceImage.sprite = cardData.cardFaceImage;
             title.text = cardData.cardTitle;
             subTitle.text = cardData.cardSubtitle;
             description.text = cardData.cardDescription;
             if(cardData.cardAttitude == Enums.CardAttitude.NEGATIVE)
             {
                 description.color = new Color(255,0,0);
             }
         }
Problem is only the last card instatiated actually changes it's image and text. What am I missing?
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                