So I have some arrays of integers that I want to loop through. I take an element from one array, and try to find the same element in another array. It works the first time around, but is unable to find a matching element the second time around. What did I do wrong?
public FighterBehaviour2[] bots = new FighterBehaviour2[12];//FighterBehaviour2 is another script
int[] scoreTemp = new int[12];
public int[] scores = new int[12];//Values are generated in an unrelated part of the script
int st;
bool isSt(int test){
if (test == st) {
return true;
} else {
return false;
}
}
for (int p = 0; p < 12; p++) {
scoreTemp [p] = scores [p];
}
System.Array.Sort (scoreTemp);
System.Array.Reverse(scoreTemp);
FighterBehaviour2 bot1;
for (int i = 0; i < 6; i+=2) {
st = scoreTemp *;*
Figured it out, I put a curly bracket in the wrong place.
@RobAnthem , you were right. The value of scores was changing at the wrong time, in a different part of the script (it would reset all values to 0.)