Hello Unity fellows !
Would it be possible to limit an Input.GetKeyDown input to a specific Update() function ?
Using if statements would obviously solve the problem but is there not any faster solution to isolate such an input ? See a basic example below : If I press the Jump Key both Update() functions will do their work.
public class Jump : MonoBehaviour {
void Update() {
if (Input.GetKeyDown("space"))
// Things related to a jump
}
}
public class otherClass : MonoBehaviour {
void Update() {
if (Input.GetKeyDown("space"))
// Things not related to a jump !
}
}
Thank you very much for your help.
I’m open to any suggestion, my goal being to head for the most effective and less cumbersome method imaginable.