In Unity, a TMP_InputField, in the Input Field Settings section of its editor, has a property called lineType:

enter image description here

This is a property of type TMP_InputField.LineType, an enum with 3 possible values; SingleLine, MultiLineSubmit and MultiLineNewline .

The difference between SingleLine and the two multi-line values is obvious - when typing text into my input field in the former, it will all remain on one line, even if the line is longer than the text box width. The muti-line values will of course make long text wrap onto a new line.

The difference between the latter two values is not obvious to me, and the documentation I linked to is pretty bare bones. Can someone explain what the difference is between the two of them?

Robin's user avatar

Single Line :

Only allows text to be on a single line.
This allows single line input, which means when you write anything, this will stays in single line regardless you press enter or not. It won't have multiple lines.

Multi Line Submit :

Allows text to use multiple lines. Only uses a new line when needed.
This allows to have multiple lines in your input field, but it won't take user's enter. It will have new line when it detects your input field's size and have new line when it reaches at the end of first line.

Multi Line Newline :

Allows text to use multiple lines. User can use a newline by pressing the return key.

This allows user to have multiple lines, whenever user want. like we use notepad or Textedit or worddoc file..

Here is reference image to help you better understand

enter image description here

Shweta's user avatar

As far as I remember

Multiline-NewLine, enter makes a new line, you have to click submit Multiline-Submit, you can have multiple lines, but enter performs submit

BugFinder's user avatar

SingleLine is of course trivial: No multi lines & Enter = submit

MultiLineSubmit: Enter = submit & Shift + Enter = new line instead. Additionally on mobile phone (or in general soft-) keyboards you usually will only see the submit key and new line might be hidden/unavailable.

MultiLineNewLine afaik means: Enter = new line & There is no built-in submit key => Instead you usually handle the submitting rather via a secondary additional UI button or code explicitly. On mobile phone keyboards you usually will see the normal new line key and no submit

It's mainly about how you handle e.g. the onSubmit event vs cancelling input etc.

derHugo's user avatar

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.