How do I allow Unity attributes to be on their own line?

Completed

I am using Rider in a Unity project that has a bit of history (and some lost tribal knowledge). Right now I try to write this code:

[SerializeField] 
private float number = 2.0f;

But Rider always autocorrects to this:

[SerializeField] private float number = 2.0f;

How can I disable this autocorrection for everyone working on my project? I want to allow either form as valid.

0
4 comments

Hello! You can change this here: `File | Settings | Editor | Code Style | C# | Line Breaks and Wrapping` > `Arrangement of Attributes` section > `Place field attribute on the same line > Never`.

1

Hi!

And how would you add a blank line between the [Header()] tag and [SerializeField] ?

[Header("Title")]
[
SerializeField]
private float number = 2.0f;

The correct form being : 

[Header("Title")]

[SerializeField]
private float number = 2.0f;
0

Hello!

At the moment there is no such rule, but we have this feature request on our tracker. We would appreciate it if you could upvote the issue to demonstrate additional interest.

0

Thanks! You have my upvote!

1

Please sign in to leave a comment.