How does "Input.eatKeyPressOnTextFieldFocus" work on compilation ?

Hi,

I’ve a pretty weird problem when trying to allow the Return Key while the user is typing in a TextField : what I want to do is avoiding him having to click on the Log In button.

Looking at the various answers given on the site I saw that the command line

Input.eatKeyPressOnTextFieldFocus = false;

could be used in order to allow Keys to be used in TextFields.

For now it works well be the problem I have is the C#-MonoDevelop tells me this command line is obsolete. But without it I can’t manage to use Keys in TextFields. The weird thing is that after compiling the whole project once it works even if I delete the line :s

Long Story Short :

  • the Keys input don’t work in TextFields
  • I add the command line “Input.eatKeyPressOnTextFieldFocus = false;” and it works well even if it tells me that this command is obsolete
  • I can remove the line and compile again and it still works
  • if I close the project and re-open/re-compile it the Keys input don’t work anymore: I have to compile another once with the command line

I really don’t get how this can happen so I hope you guys could give me a hint :smiley:

This example might help:

http://forum.unity3d.com/threads/188202-Simple-dynamic-list-editor