How to use a nested for loop, to gather a group, from 1 array question

Hi there,
I am wondering something,

I have a situation, where I want to save my self a bunch of code, so I would like to use two arrays to handle what would otherwise be 12 of each.

I have a path, I want to create. It is made up by the random positions of 3 nodes. My idea is to have a for loop create each path no problem, but, it will also have a nested for loop. this will be to gather the appropriate node, from nodes array to pass to the path for creation.

The trick is, when i (or in the below example p) is 0 it works, but go above 0 and the values for n, nodes will be the same over and over. I want them to behave like this., when i = 0, gather nodes 0-2. i = 1, nodes 3-5 etc, in progressive groups of three.

//path creation process
for(int p = 0; p < pathArray.Length; p++){

//before creating each tween path, it must know nodes that will make it up.
/// this is where my issue is.

for(int n = 0; n < 3; n++){
///'the issue is, this will only work when p = 0
}


//go on to create path here
}

Can anybody see what I can do to keep my number of arrays to a minimum?

Thanks.

You need to multiply i by the length of the inner loop.

So:

int nodeMember = (i * 3) + n;

Oh right!
I knew it was simple.
Cheers.