Rider insists on making Unity [Header] attributes inline
I have a very annoying issue where, whenever I create a Unity [Header] attribute and then put a field under it, Rider moves my field up onto the same line as the header. This is very unintuitive and undesirable behavior for a header. How can I stop this from happening?
Please sign in to leave a comment.
Hello Sy ,
Thank you for reaching Rider Forum.
It seems that it is required to tweak the settings in Settings | Editor | Code Style | C# > Arrangement of attributes > Place property/indexer/event/attribute on the same line option.
All in all, if you face any bothering formatting rule, you may find it by following the instruction below:
Configure formatting rules for selected code
Setting “Place field attribute on same line” to “Never” does fix this; but then all other attributes, like [SerializeField] are then placed on the line above, which is not desirable.
I would like a way to have attributes like headers appear above, while others are inline.
Hello Sy ,
Could you please share with me the code snippet where the issue is reproduced then?
Examples of the desired and undesired formatting would help a lot.
Looking forward to your response.
Expected/desired formatting:
Actual formatting:
Attributes which effectively apply to a group of fields should always be placed above; while attributes that are only applied to a single field should be inline by default.