I have a script in which I have to instantiate 100 cards on 100 different locations which are generated by the script ie 10 rows and 10 columns. so when I run play it generates 100 different cards on each of the 100 different locations that means it generates 10,000 cards. all I need to do is generate 100 cards on the 100 positions. I am new bie to programming so I am sure its a dumb one for all of you pros but any assistance is good my script is as below:
'''
private void GenerateGrid ()
{
{
for (int row = 0; row < rows; row++) {
for (int col = 0; col < cols; col++) {
float posX = col * tilesize;
float posY = row * tilesize;
{
float xoffset = -4f;
float yoffset = 4f;
transform.position = new Vector2 (posX + xoffset, posY + yoffset);
foreach (string card in deck) {
GameObject newCard = (GameObject)Instantiate (cardPrefab, transform.position, (Quaternion.identity));
//GameObject newCard = (GameObject)Instantiate (cardPrefab);
newCard.name = card;
}
}
}
}
}