Event.current.keyCode not working

Is there a reason why:

if (Event.current.type == EventType.KeyDown && (Event.current.keyCode == KeyCode.Enter || Event.current.keyCode == KeyCode.Return))

doesn’t work anymore?

I get the following error message, even though all over the forums ppl say this worked for them:

BCE0051: Operator ‘==’ cannot be used with a left hand side of type ‘UnityEngine.KeyCode’ and a right hand side of type ‘System.Object’

What the hay?

p.s. i’m using it to detect input text “return” key inside a text field, so i can’t use any other input detection method that i know of.

There’s no such thing as KeyCode.Enter (rather, KeyCode.KeypadEnter), but other than that, the code will compile without any issues. Maybe you made your own class called KeyCode?

Used this in the end:

if (Event.current.Equals (Event.KeyboardEvent("return")))