Is it possible to declare a jagged array that contains both strings and ints?
I currently have a string array, but I would like some of the elements to ints.
I have declared it like this:
public string [][] myArray;
void Start(){
string [][] myArray = new string[5][];
myArray [0] = new string[]{"String", "String" "Number", "Number"};
}
If I could have mixed elements I wouldn’t have to go trough all the converting back and forth between string/int
Maybe you could create a struct for it?
public struct StringInt {
public int myInt;
public string myString;
}
@gjf It’s used to store character stats mostly, but the first two elements will be strings.
@leafypixiestix I’m not sure if using a struct will be as easy when I need to access the different elements, there’s quite a few of them.
At the moment I’m using int.Parse / int.toString() to change the different elements. It’s not a big problem I’d just like to save myself the trouble 