Unity TextField iOS how to close keyboard after entering text?

Hi there, I’ve created a username textfield that opens the keyboard by default. My question is how to allow the user to close the keyboard when done. I put a OK button under the textfield but this one gets covered by the default keyboard and so after entering the name there’s no way for the user to go back.

username = GUILayout.TextField(username, 15, "UsernameTextfield", GUILayout.Height(screenHeight*0.1f), GUILayout.Width(screenWidth*0.2f));

how can I lose the focus of have a done button?

I’m new to unity, but a quick hack for this was to go into xcode and edit the “/Classes/UI/keyboard.mm” file. playing around with the parameters in these lines did the trick.

//fieldToolbar.items = [[NSArray alloc] initWithObjects:inputItem, doneItem, cancelItem, nil];

fieldToolbar.items = [[NSArray alloc] initWithObjects:doneItem, cancelItem, nil];

// inputView = multiline ? textView : textField;

// toolbar = multiline ? viewToolbar : fieldToolbar;

   inputView = textView;
   toolbar   = fieldToolbar;

[UnityGetGLView() addSubview:toolbar];
    [UnityGetGLView() addSubview:inputView];

it seems that there is some issue with multiline edit (if the fix suggested works for you).
Please bug report it with small repro project.

In the “/Classes/UI/keyboard.mm” file create a new baritem in the init like:
UIBarButtonItem* okItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem: UIBarButtonSystemItemDone target:self action:@selector(textInputDone:)];

replace in: viewToolbar.items = [[NSArray alloc] initWithObjects:okItem, cancelItem, nil];

release like the other buttons

voila, textfield and textview works like a charm together.