Visual Studio 2017 Inconsistent Line Endings

I've been working through some Unity tutorials using Visual Studio 2017 as the script editor on Windows.

One frustration that I came across was that each time I created a new script and saved it, both Visual Studio and Unity would complain that I had Inconsistent Line Endings in my new file. In previous versions of Visual Studio there was an option under the File menu, Advanced Save Options..., where you could set the line endings you wanted to use. According to this post on the Visual Studio Developer Community forum this item was removed from the menu because it wasn't being used much. The good news is that you can add it back in quite easily.

  • Go to Tools -> Customize then click on the Commands tab.
  • In the Menu bar dropdown select File then click the Add Command... button.
  • Click the File category, select Advanced Save Options... then click the OK button.
  • Use the Move Down button to move it to where you want it in the menu.

I went one step further by then clicking the Keyboard... button and assigning a keyboard shortcut Ctrl-A,Ctrl-S to make life even easier.

Ideally, I'd like to be able to set an option that automatically ensures the line endings are consistent but I'm not there yet. This will do for now.

Sort:  

Ok, I found the setting in Unity that I should have been looking for...

  • Go to Edit -> Project Settings -> Editor
  • Scroll to the bottom of the Inspector window and set the Line Endings For New Scripts Mode to Windows

You can also edit the script template used for the new scripts found in C:\Program Files\Unity\Editor\Data\Resources\ScriptTemplates

Still haven't found anything more helpful in Visual Studio but I have seen that there are some plugins you can get. For me, I'm now content with what I have so I won't be pursuing it any further.

Coin Marketplace

STEEM 0.09
TRX 0.32
JST 0.030
BTC 113060.88
ETH 3817.99
USDT 1.00
SBD 0.67