Event.current.type doesn´t work

hey there

i have this code in my projekt:

	void Update(){
		
		if( Event.current.isKey == true  Event.current.type == EventType.keyDown  Event.current.keyCode == KeyCode.UpArrow){
			Debug.Log("Oben");
						
		}
}

this code doesn#t work and i get this error:

“NullReferenceException: Object reference not set to an instance of an object”

anybody who can help me ?

thanks :smile:

Unfortunately, Event is only updated in OnGUI.

If you’re using Update, use the Input class instead of Event.

–Eric

ofcourse -.- sorry :smile:
thanks for help :smile:

Somewhat on topic - it would be really nice to have a more generic method to poll input from Update. Something like - “If the user presses any key give me the KeyCode associated with that key”. You can poll specific KeyCodes and you can check if the user pressed any key but you can’t do both without doing the checks in OnGUI with Event.