inconsistent line endings

If you are looking for NewBehaviourScript.cs in order to change the line endings permanently (which is my preferred solution), the name and location has changed. It is now

Editor\Data\Resources\ScriptTemplates\81-C# Script-NewBehaviourScript.cs.txt

You can change the line endings as described above using Visual Studio, or in Notepad++ using Edit > Format Line Endings > Convert to … (whatever you prefer).

3 Likes

SWEEEEET!!!

Thank you! This is the most sensible suggestion here.

In Visual Studio 2012:
File > Advanced Save Options
In “Line endings” select “Unix (LF)”

notepad++ have moved the option for this, it’s now: “edit > EOL conversion > format”

I prefer this answer, thanks.

In Visual Studio 2015:

ToolOptionsEnvironmentsDocumentsCheck for consistent line ending on load.

It will then propose you to convert line ending on opening. Then just open the files and save them.

This worked for me, never got the error again

7 Likes

Great Solution!! very good!!

omg! awesome solution! you saved my days in change Advanced Save Options each time I create script!! :):):slight_smile:

Thank you, that fixed it in my Visual Studio 2010.

Thank you so much! This helped

Strin’em is supposed to do the trick. If you don’t like it you can uninstall it vis the Tools->Extensions and Updates Installed tab.

But I cannot save the text document in Unity\Editor\Data\Resources\ScriptTemplates in unity5.6beta

To save this file you need to execute visual studio with administrator rights.

Thanks for this information. The add-in you mentioned was not compatible with Visual Studio 2017, so for those in the same boat i found this add-in on the Visual Studio Marketplace and it installed and seems to work like a charm. Line Endings Unifier by Jakub Bielawa
https://marketplace.visualstudio.com/items?itemName=JakubBielawa.LineEndingsUnifier

1 Like

But I could’nt find Advanced Sace Options in visual studio

If you are on VS 2017 I dont think its there any more.
Seek another solution, there are more posted in this thread.

it’s just in the “save as” options now (not that that makes much sense…)

3115045--235572--upload_2017-6-20_18-51-37.png

1 Like

Ah nice catch, I would never have seen that.

Just opening the script with Visual Studio in the directory above and saving it (no changes to the file) fixed the problem for me.

1 Like