- Home /
public string array controlled by an int in the inspector
Basically what I'm trying to do (and am lost in the fact it something new for me) is have a public int intName; to controller the number of public string[] stringArray; in the inspector.
So in the inspector it would look like;
intName 2 (which I could change the number to add more strings.)
string 2
Dialog01.
Dialog02.
sting 1
Dialog01.
the int would show the 2 string arrays in which I can change each of the array counts for each of those stings. If that makes sense. Sorry I don't have any code to share. Everything I come up with is getting me no where. Thanks in advance for any help!!!
Answer by Bunny83 · Apr 27, 2017 at 02:54 AM
I'm not sure if i understood your question properly, but i guess you want something like:
[System.Serializable]
public class Dialog
{
public string name;
public string[] lines;
}
public class SomeMonoBehaviour : MonoBheaviour
{
public Dialog[] dialogs;
}
Damn first answer out the gate gets it done! Thanks man! I knew I was way overthinking it. I was trying way more elaborate things then this. Thanks again!
Your answer
Follow this Question
Related Questions
Converting String Array to Int. 2 Answers
Changing a GUI String to read as a INT 2 Answers
pick a random int with the value of 1 from an array 2 Answers
Convert Array to String 3 Answers
Variable data type for two ints (x and y) in inspector 3 Answers