Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
kburke's avatar
kburke
Honored Guest
11 years ago

Listening for health & safety button keypress?

Okay, this may be a dumb question. Say I want to present a dialog that says "Face forward and press any key when you are comfortable" or some kind of similar recenter dialog.

If I write something like the following:

void Update() {
if (state == STATE_INIT) {
drawRecenterDialog();
state = STATE_RECENTER;
} else if (state == STATE_RECENTER && Input.anyKeyDown) {
// record user's default position and start the application
}
}


When the user presses a button to dismiss the health and safety warning, the second branch will also get triggered, incorrectly. I believe that the health and safety warning also goes away after some amount of time (even with no keypress). How should I code for this? Is there a variable or setting that detects the presence of the warning?