Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Question Unwanted indentation between comment and function (Visual Studio), needs help disabling.

Discussion in 'Editor & General Support' started by XregularC, Apr 25, 2020.

  1. XregularC

    XregularC

    Joined:
    Apr 6, 2016
    Posts:
    2
    I created a new c# script and started with a comment to explain what my script does. Once I were done writing my comment I went down two lines and wrote a function there, the function Foo. Realizing I should create the function Bar first I selected the line between my comment and Foo, pressed return and created the new function Bar. I now noticed an unwanted indentation had been made:

    Code (CSharp):
    1. public class ExampleScript : MonoBehaviour
    2. {
    3.     //This is my comment
    4.  
    5.         void Bar() {
    6.  
    7.     }
    8.     void Foo() {
    9.  
    10.     }
    11. }

    Testing it again I notice the indentation occurs as I create the new line by pressing return.
    If I select everything and press Ctrl-K, Ctrl-F then it is as it should.
    I do not know why I encountered this problem first now. Maybe it's because I just installed Unity version 2019.3.11f1? I've been unable to find a solution to this, actually I found it difficult finding others with the same problem. Naturally, all help is appreciated.

    I'm using Unity 2019.3.11f1 and Visual Studio 2017.

    Settings in visual studio that might be relevant:
    Tools --> Options --> Text Editor --> C# --> Tabs:
    Indenting: Smart
    Tab: Keep tabs
     
  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,566