Hi Penny,
Can you confirm, it is definitely Visual Studio you are using and not MonoDevelop?
Visual Studio has a wealth of customisation options available for how code entry/formatting will happen. You can access these from Tools / Options.
You can select Text Editor and then expand the various branches underneath;
I’ve had a quick look through myself this morning and haven’t spotted anything specific to the behaviour you are describing, but of course the option may not be labelled “Attribute” for example. What I can say is that using Visual Studio myself I am able to enter either;
[SerializeField] private string message;
or
[SerializeField]
private string message;
No auto-formatting takes place for myself, although my personal preference in the second in the examples above anyway. This is why I ask at the top of this reply whether you are definitely using Visual Studio or MonoDevelop, as they will have separate options, Visual Studio has far more and is a richer IDE in my opinion.
I did run a couple of Google searches on your behalf also, I found articles asking about this specific feature but from about 6 years ago, some even give Unity as the context and the [SerializeField]
attribute as the example. At that time it certainly looks like options weren’t available, although one person did suggest pressing CTRL + Z (undo) when the formatting takes place, that seems like a better solution than you having to press backspace numerous times if nothing else.
It would take a little time, but I would be happy to provide screenshots of the options I have selected/un-selected so that you could compare to your own configuration, this my help narrow down the search to find any difference between my setup and your own. There is the ability to export/import the user settings too, but I wouldn’t to overwrite anything that you have specifically set, so checking manually may be a more careful approach.
Another option for you, if you can’t get to the bottom of it, would be to wrap all of your attributes in a Region, that way, you could make them collapse if the amount of space they take up concerns you. For example;
#region "Squishy Attributes"
[TextArea(10, 14)]
[SerializeField]
private string storyText;
[SerializeField]
private State[] nextStates;
#endregion
Expand Region
Collapsed Region
Region can be useful, however, with the limited amount of code you have in any one class in this course, you’ll probably just find yourself forever opening/closing regions - it’s also a very easy way to forget you’ve already typed something out and enter it again, causing errors that, at a glance, aren’t so obvious.
I hope something from the above is of use to you, if I find anything more concrete with regards to a specific solution I will let you know. Please do double-check the IDE you are using though, as you won’t find a lot of the above necessarily in MonoDevelop.