Adding to and resizing an array based on a variable (c#)

in this project there are scriptable objects for a creatures race, inside this object is an array of other scriptable objects called bodyparts, it looks like this:

what I want to do is add this array of body parts into another array on a different script (the characters equipment script) bear in mind that the creatures all have different numbers of bodyparts so the size of the array will be variable

how could I achieve this?

1 Answer

1

If I understood it right, would something like that be a solution to your Problem:

//Your array of arrays in the other class
ScriptableObject[][] test = new ScriptableObject[2][];
    
Start()
{
    //Adding the arrays of bodyparts to this array of arrays
    test[0] = new ScriptableObject[2];
    test[1] = new ScriptableObject[5];
}

You're welcome, glad I could help! :)