GUI.TextField allows enter multi-line?

I’m using the following line in my code to allow the user to enter a profile-name:

MainGame.MyProfileName = GUI.TextField (new Rect(Screen.width/2-125*myGUIScale,Screen.height/2, 250*myGUIScale, 20*myGUIScale), MainGame.MyProfileName, 16, myStyle);

When I look at the description of the GUI.Textfield, it tells me “Make a single-line text field where the user can edit a string.”, but when I test the code in the Unity editor it allows me to use the ENTER key to make multiple lines, and when I display the MainGame.MyProfileName, it shows the ENTERs as well.

Is there any way to avoid people from using the ENTER key when using GUI,TextField?

Search the string, and if it contains a newline character, remove it from the string.

Yeah, I got that already, but is this function supposed to act like this? Also, what to search for ‘/n’ or ‘/r’?

Not sure. It hasn’t been doing that for me.

This is the code I’m using for it, and it works fine on my end.

private void DisplayName() {
		GUI.Label(new Rect(10, 10, 50, 25), "Name: ");
		_toon.Name = GUI.TextField(new Rect(65, 10, 100, 25), _toon.Name);

Is this a bug? It’s been happening to me while trying to write a KSP plugin. I have searched and searched and cannot find a proper solution. By which I mean using Event’s Use or something like that. I feel I should not have to add extra variables to handle intercepting the return key, or extra method calls to trim the string, etc.