0

so I'm trying to take the number specified in "howManyGroupsOfEnemies" and create THAT many public arrays of game objects. How would I go about doing that?

public int howManyGroupsOfEnemies;
ProgrammingLlama
  • 36,677
  • 7
  • 67
  • 86
fourarms
  • 1
  • 3
  • Question a little unclear. Do you want `howManyGroupsOfEnemies` to determine how many elements you want in an array, number of elements in a 2d array, how many array objects you have? Can you provide more sample code explaining what you're wanting to achieve. – Hayden Jul 08 '22 at 03:48
  • @Hayden why it is unclear - seem to be regular run-of-the-mill "how to create dynamic variable names at run-time" question. Also in this case it probably "how to pick my objects from a list by group Id" like `allEnemeis.Where(e => e.GroupId = 42)` or maybe `allEnimies.GroupBy(e => e.GroupId)` would be more useful... – Alexei Levenkov Jul 08 '22 at 04:00

0 Answers0