Right now I am programming my FPS game and I wanted it so that if the player has not pressed any keys for 30 seconds, a waiting/idle animation plays where the character looks at his gun. I’ve been searching on the forums for a while but I haven’t been able to find anything on how to check if there has been no input for a certain amount of seconds. Does anyone know?
This is something you have to code yourself. A timestamp model would be simple. At the top of the file:
var timestamp = 30.0;
Then in Update() if any key is pressed do:
timestamp = Time.time + 30.0;
Also in Update():
if (Time.time >= timestamp) {
Debug.Log("No key as been pressed for 30 seconds");
}