- Home /
Store an array inside of an array
Hello community,
can I store an array inside of an array?
I am working on a dialogue-system, and I want to set the numbers of chat-themes the player can choose, inside the inspector. Every theme has it's own number of sentences. That's why I need an array "themes" and inside that an array of Strings.
Any other approaches to my problem?
Answer by Thom Denick · Jul 27, 2012 at 03:29 PM
Hi Rick, I'm assuming you are using C# in my answer here:
Arrays are great if you have a number of values that don't change object-to-object. Like for instance, a high score list. For fluctuating arrays like you describing then List is better: http://www.dotnetperls.com/list
However, based on your description of the problem, you probably want to use Dictionaries for your solution. To read more on how to implement those, check this article out: http://www.dotnetperls.com/dictionary-keys
As to the title of your question, in C# we have what are called Multi-dimensional arrays. It may take you a few read throughs of this document to get your head wrapped around it, but it's a fairly simple implementation and great for storing huge grids of info.
Thank you very very much for your answer. I am using JavaScript. But I will give it a read, thanks again. :-)
and/or take a look at the 'Classes' of this pearl beginner guide: http://forum.unity3d.com/threads/34015-Newbie-guide-to-Unity-Javascript-%28long%29
Your answer
Follow this Question
Related Questions
How to delete new'd arrays? 2 Answers
what is the difference between a float[] and a float[,]? 1 Answer
How to set parents of all objects in an array? 1 Answer
Parse Array data to generate html 0 Answers