Unity Issue Tracker - Singleline constraint ignored on TextField when value set in code to string with \n
Fixed
UUM-21496
Singleline constraint ignored on TextField when value set in code to string with \n
Unity: UI Toolkit Controls
Fixed
2023.3.X
2023.2.X
Won't Fix
2023.1.X
For this use, users should escape their escaped sequences before setting it through value. Otherwise, the generator will interpret them as valid characters and parse them accordingly.
For this use, users should escape their escaped sequences before setting it through value. Otherwise, the generator will interpret them as valid characters and parse them accordingly.
Fixed inconsistent multiline validation in TextField. This fix makes single line text field omit the new line characters when set through the value prop.
Summary:
A user can set a TextField's multiline to false in code, but can then have a multiline value if he sets the value IN CODE to a string which contains \n.
Extra Notes:
When the value is set in code, there is no check for the multiline attribute.
Reproduction steps (in code):
1) In code, create a TextField
2) Set multiline = false
3) set the value to any string with a \n
Expected Results:
The \n is ignored and the string is displayed on 1 line.
Actual Results:
string is displayed on 2 lines.
Tested on:
Unity Version 2023.1.0a24, WIN10
Branch <name> [<commit hash>]
Prioritise and Follow this issue
Have a workaround or additional info about this issue?