| bot1 = new GameObject[bots.maxBots]; for (short i = 0; i < bots.maxBots; i++) bot1[i] = new GameObject( Content.Load bots.Add(bot1); |
Is there anyway I can substitute the bot number with a variable and put it in a loop (to create 100 bot1s, for example). Something like this:
| for (short i = 0; i < 100; i++ { bot + i = new GameObject[bots.maxBots]; for (short i = 0; i < bots.maxBots; i++) bot + i[i] = new GameObject( Content.Load bots.Add(bot + i); } |
VulpesPosted Aug 25, 2011, 3:43 PM
Variable names must be known at compile time.