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?
Answer by Droidenkiller · Jul 08, 2016 at 06:36 PM
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];
}
Your answer
Follow this Question
Related Questions
Index out of range error 1 Answer
least 'expensive' way to go through list and check transform.position 0 Answers
How to spawn sprites in a row randomly from a single array without double-ups 0 Answers
Array with pushing values? 0 Answers
How to display elements of an array, using a 3D text Box? 1 Answer