TextArea doesn't work anymore?

I’m trying to make my string input in the inspector have mroe than 1 line, but the TextArea flag doesn’t seem to work. I’m using Unity 2021.3.20f1 LTS.

[TextArea] [SerializeField] private string stepText;

but it stays one-line:

8875194--1212114--upload_2023-3-14_7-23-53.png

NOt sure if this is a Unity Bug or I’m doing something wrong. None of the Text Areas seem to work, even with scripts that’s part of Unity, such as InputField.

Just tested it on my Project, using 2021.3.19f1 LTS version.
For me it does work, seems like a bug in your GUI?
Or there was any change from .19f1 LTS to .20f1 LTS ?

i tested following:

[TextArea] public string description;

and:

[TextArea] [SerializeField] private string description;

both seem to work like a Textarea

1 Like

Try [SerializeField, Multiline] instead.

2 Likes

Just based on the “InstanceID” and “Local Identifier in File” I would assume you switched your inspector into debug mode. In debug mode no custom editor or property drawer would be used. Also the inspector would show even private and internal variables. So you should switch the inspector back to normal mode. You want to avoid the debug mode in most cases and it should only be used temporarily when you really need to debug something.

3 Likes

Oh wow… Lol. I didn’t even notice. This whole time I thought to myself “Unity 2021 is showing me a lot more info, huh?”. That was the issue.

1 Like

I know this is years later but based on the multiline comment, after Searlizefield add in the same box TextArea with the parameters you want, for example here is what I did for a similar situation:
[field: SerializeField, TextArea(3, 10)] public string[] Sentences { get; private set; }
I’ve done this with Unity 6 and it will likely work on some of the earlier ones to.
I have checked as well it works with normal SeriaizeFields:
[SerializeField, TextArea (3, 10)] string _name;

I hope this helps!

Have you actually read the whole thread? There never was an issue here, the attributes work as expected. However when you switch the inspector into debug mode, none of the propertydrawers will be used.

You don’t exactly have a similar case as you have an auto property so of course the attributes needs to be attached to the auto-backing-field and not the property itself. That’s why you have to use the prefx field:. So it’s not really related to the issue in this thread besides you have the same symptome because you may have used the attributes wrong.
If you apply the attributes separately you would have to do
[field: SerializeField] [field: TextArea]
as all those attributes need to be on the backing field and not the property.

1 Like