- Home /
How to fix this for c#?
I have the following condition:
//written in JS
if(Event.current.type == EventType.keyDown && Event.current.character == "\n" && inputField.Length > 0) {...}
how do I express exactly the same in C#?
Comment
Answer by robertbu · Aug 17, 2013 at 08:36 PM
The only change the quotes around the '\n':
if(Event.current.type == EventType.keyDown && Event.current.character == '\n' && inputField.Length > 0)
Oh wow, I can't believe I oversaw that. Embarassing. Thank you a lot, ofc I can't compare a char with a string! -_-
Your answer
![](https://koobas.hobune.stream/wayback/20220613112418im_/https://answers.unity.com/themes/thub/images/avi.jpg)