I’m using this to make my character select in a tower defense game. You pick 5 towers and then I’m reading the static boolean values from another script (this script), in another scene (my gameplay scene).
this is my script
void Start(){
for (int i = 0; i < 5; i++) {
Vector2 buttonPos = new Vector2 (i + 1, 6);
for (int p = 0; p < numberOfAvailableDefenders; p++) {
if (selectedBoolArray [p] == true) {
GameObject buttonSpawn = Instantiate (buttonArray [p], buttonPos, Quaternion.identity) as GameObject;
buttonSpawn.transform.parent = transform;
selectedBoolArray [p] = false;
//setTrueAfter [p] = selectedBoolArray [p];
break;
}
}
}
}
like I said the error is a logic one. Everything is working fine and all of the Boolean values are coming through correctly. The issue is that the selected defenders aren’t the ones in the game scene. The Defenders you get are just random.