How to Stop Special Characters in Inspector e.g. '\n' '\r' (potential bug)

When using a text field in the inspector special characters seem to be used.
For example typing \n will produce a new line in the field, and \r will return the string to the beginning which shows overlapping text in the field.

for example in the inspector for a string field, you can see this behaviour.
[SerializedField]
private string foo;

I’m currently using Unity 2022.2.12f

Is this intended behaviour or is this a bug?
If it’s intended how can I prevent this.

Can you elaborate where you are talking about exactly? Because some things will and should support it, others won't.

This is just in the inspector, with a string field. [SerializedField] private string foo;

1 Answer

1

I’m on 2022.3.20f1, and it seems to work here:

image

Probably a bug that got fixed after the version you’re on. I’d update to LTS!

Yeah I thought it might be a bug, Thanks for verifying, I've tested on later versions and it also doesn't happen on them, can't upgrade unfortunately, guess just have to stick with it.