textField - disable enter? how to

how to disable enter in the text field, when pressed input goes up if there is more characters left… or to make it trully one line…any ideas are welcome, thanks!

This should work.

It gets the text from the TextField, then replaces newline characters with nothing.

var theText  :  String  =  "Enter text";

function OnGUI ()
{
    theText = GUI.TextField(someRectangle, theText);
    theText = theText.Replace("
"[0], "");
}

Remember that you are the one passing the variable to the TextField function every frame, so you can do anything you want to the value of the string.

You could even do it all in one line if you want to be one of those programmers who thinks it's better to do it that way:

theText = GUI.TextField(someRect, theText).Replace("
"[0], "");