Search Unity

Resolved How to automatically put spaces between attributes in Visual Studio 2022?

Discussion in 'Scripting' started by Unrighteouss, Mar 20, 2022.

  1. Unrighteouss

    Unrighteouss

    Joined:
    Apr 24, 2018
    Posts:
    599
    Hello,

    I recently installed VS 2022, and I can't find the option to add spaces between attributes automatically. It did this by default in 2019 and I've gotten used to it. To make matters worse, it's automatically removing the spaces I add :(

    I've tried searching for "bracket" or "attribute" in the VS options to no avail.

    To be clear, this is what it's doing now:
    [[SerializeField][Range(0, 15)]


    And this is what I would like it to do:
    [[SerializeField] [Range(0, 15)]


    If anyone knows how to do this, I would greatly appreciate the help. It's a small thing, but it's really bothering me haha.

    Thank you.
     
  2. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    7,927
    Dunno if this works for you, but you can inline multiple attributes with commas. Eg:
    [SerializeField, Range(0, 15)]
     
  3. Unrighteouss

    Unrighteouss

    Joined:
    Apr 24, 2018
    Posts:
    599
    How have I never seen this before? Yes, this works for me; this is actually way better than spaces for clarity.

    Thanks!