0

I've started an old project again (with new ideas and in Unity) and I'm stuck. Basically I need a lot of public arrays (mostly so they appear in the editor). Is there a way to "name" those arrays using existing strings? For example :

string[] arrayNames = new string[]{"FirstArray", "SecondArray", "ThirdArray"};
for (int i=0; i<arrowNames.Length; i++){
    //Here i would create the new array using the string
    public Sprite[] arrowNames[i] = new Sprite[10];
    //Code to populate new array comes here
}

This code is just the idea of what i need. Anyone know a way to do this? Thanks.

5
  • 4
    Do you something like Dictionary<string, Sprite[]> ? Commented Jul 31, 2016 at 10:16
  • @user3185569 Put that as an answer Commented Jul 31, 2016 at 10:17
  • 1
    Why? It has been asked a million times, just close as duplicate. @Programmer Commented Jul 31, 2016 at 10:19
  • @PatrickHofman Ok. Didn't know that. Commented Jul 31, 2016 at 10:22
  • Thanks @user3185569. As for the duplicate issue, I'm sorry. I looked before but couldn't find. Commented Jul 31, 2016 at 10:44

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.