GUI.TextField

Hello,

I am using a textfield for getting the name of the player.

Pname = GUI.TextField (Rect (300, 350, 400, 50), Pname, 25, myStyle);

However, I have a problem with it. The player can also press enter to go to a new line. This causes a glich in my save system. Is there any way disable the enter, and the new line?

Thanks!

1 Answer

1

That’s odd. TextField shouldn’t allow newlines, only TextArea.

You could remove them from Pname with String.Replace:

Pname = Pname.Replace("

“,” ");

This has solved the problem, thanks! :)