void Update () {
if (Input.GetKeyDown ("k")) { // **K is a placeholder for L3
do{
x++;
i++;
if (x == 5){
x = 0;
}
if (i == 5){
ParentPanel.SetActive (false);
}
}while (completion[x] == true);
i = 0;
}
if (Input.GetKeyDown ("q")) { // **Q and following keys are placeholders for completing an objective
completion [0] = true;
}
if (Input.GetKeyDown ("w")) {
completion [1] = true;
}
if (Input.GetKeyDown ("e")) {
completion [2] = true;
}
if (Input.GetKeyDown ("r")) {
completion [3] = true;
}
if (Input.GetKeyDown ("t")) {
completion [4] = true;
}
ParentText.text = objectives [x];
}
}
The way this script works is that after all the objectives have been completed the instance of the loop will return five failures to find an index of an uncompleted objective. After which it disables the UI panel that shows the text. This same panel contains this script inside a child text. Running this script and getting to the point where the panel is set inactive causes the unity editor to crash and forces me to terminate the program. Is there specifically a problem with setting an objective inactive in a script when the object contains that script? Do I need to move the script somewhere else so it can finish it’s termination?