Closing Textfield via Input.GetKeyDown not working under MacOSX(No problem under Windows)

I use the attached code to load a level on Input.GetKeyDown, but it is not working under MacOSX, under Windows it is working just fine!

I guess it has to do with the Textfield, because closing a normal Gui.Button with Input.GetKeyDown is working fine, but I was not able to narrow it down.

var Username = "";
//
    function ShowCustomNameWindow (windowID : int)
    {
        //
    	GUI.Label (Rect (100,100,300,45), "ENTER YOUR NAME:");
    	//
    	GUI.SetNextControlName ("Username");
    	GUI.FocusControl ("Username");
    	Debug.Log(GUI.GetNameOfFocusedControl);
    	//
    	Username = GUI.TextField (Rect (142,142,178,35), Username,11);
    	//
    	if(Input.GetKeyDown(KeyCode.Return) && Username.Length != 0 
    	   ||Input.GetKeyDown(KeyCode.KeypadEnter) && Username.Length != 0) 
    	//
    	   {
    		//
    		Application.LoadLevel("xyz");
    	   }
    
    }

First of all Input.GetKeyDown should not be used in OnGui functions, for detecting any key use Event.current.

So I changed the function to :

var Username = "";
//
    function ShowCustomNameWindow (windowID : int)
    {
        //
        GUI.Label (Rect (100,100,300,45), "ENTER YOUR NAME:");
        //
        GUI.SetNextControlName ("Username");
        GUI.FocusControl ("Username");
        Debug.Log(GUI.GetNameOfFocusedControl);
        //
        Username = GUI.TextField (Rect (142,142,178,35), Username,11);
        //
        if((Event.current.Equals(Event.KeyboardEvent ("[enter]"))&& Username.Length != 0) 
        //
           {
           //
           Application.LoadLevel("xyz");
           }

    }

Basically Input.GetKeyDown(KeyCode.KeypadEnter) turned into (Event.current.Equals(Event.KeyboardEvent (“[enter]”))

Thanks to Eric5h5, who helped me to find this solution!

This example might help too:

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