Code breaks when adding another unreferenced, unassigned, randomly named variable.
I am making a system where a car will be spawned in, then will reorientate itself towards a target (in a list). then the car reaches the target, it will then reorientate towards the next target in the list, and go around in a loop. This system pretty much works. I need to add one more variable to finish, but whenever I make a new variable, the script will partially stop working (the car will orientate itself towards the second target instead of the first). The variable that I create is not assigned any value (but does not make a difference if it do assign it something),and is not referenced in any other part of the script. It can also be named anything. The variable can also be any type (int, bool etc). I can create the variable in any section of the script. If the variable is private, the script will keep working. I really have no idea what is wrong. Here is the code that works. here is the code that does not work anymore. They are identical other than the integer variable. Please don't judge too hard haha, i know that it is a mess. Thanks in advance :)