Answers for "displaying list in gameobject Unity"

1

unity list of gameobjects

public List<GameObject> gObjects = new List<GameObject>();
Posted by: Guest on July-02-2021
0

displaying list in gameobject Unity

public List<GameObject> Deck = new List<GameObject>(); // im assuming Deck is your list with prefabs?
public List<GameObject> CreatedCards = new List<GameObject>();

void Start()
{
     Fill();
}

public void Fill()
{
    foreach(GameObject _go in Deck)
    {
        GameObject _newCard = (GameObject)Instantiate(_go);
        CreatedCards.Add(_newCard);
    }
}
Posted by: Guest on July-26-2021

Browse Popular Code Answers by Language