Question by
Yogurtime19 · May 09, 2017 at 04:06 AM ·
variablevariables
Test for a variable change
Hello. In my FixedUpdate function I need to test for when a variable changes. I have an if statement that tests if a bool is true and following that is an if statement that tests if that same bool is false. Both of these if statements use the same variables, and I need them to reset to a default value if this bool changes. So, is there an operator that I can use to test for change, or perhaps some other useful trick?
void FixedUpdate()
{
if (bool == true)
{
variable x
variable y
ect.
}
if (bool == false)
{
variable x
variable y
ect.
}
if (bool == change?)
{
reset variables
}
}
It is also worth noting that these variables change depending on time, making it necessary to check for change in the bool value.
Comment