- Home /
Will the state of a boolean be constant/per frame validated or only when the value changes?
I want the character to switch between controls at some point in my game. Should I use a boolean in a if-statement to determine that or should I use a new script that wil disable the previous script that will be called with on...enter() to have best performance. I red that disabling components will eat up some performance but if statements have to be called every frame, also with boolean?
Answer by tormentoarmagedoom · May 16, 2019 at 07:57 AM
Hello.
I'm not sure to understand what you want to know. But Controls (key detections) is executed in Update, so is executed every frame.
Have all Update divided into 2 zones (if bool==true {} and else {}) will not decrease performance. I mean i think the good solution is to have a bool variable to know if need to detect once controls or the other controls.
Bye!
Thanks, So the performance will not decrease because the program will not constantly check if the boolean is true? @tormentoarmagedoom
Your answer
Follow this Question
Related Questions
how to i off load rendering to my gpu? 0 Answers
Blend Tree Transition Conditions. 0 Answers
What does Audio CPU Usage mean in the Profiler? 1 Answer
Fire and forget coroutines 1 Answer
Ridiculous CPU usage building lighting. 0 Answers