- Home /
Visual Studio 2010 causing: Inconsistent Line Endings...
There are inconsistent line endings in the 'Assets/Plugins/AIManager/Pathfinding Engine/AI/AIAgent.cs' script. Some are Mac OS X (UNIX) and some are Windows. This might lead to incorrect line numbers in stacktraces and compiler errors. Many text editors can fix this using Convert Line Endings menu commands.
Ive had this come up since i Formatted my PC sometime ago and i still cant figure out how to remove this annoying Warning i get not only in Unity but also in VS.
Whenever i make changes to a cs file i get this warning in Unity and a popup window in VS that tells me the Line Endings are inconsistent or some such and do i wish to convert them?
I havent delved to deep into the issue since its more of an inconvenience than a hindrance and thought someone else here may have come across this as well or know where to disable this feature or make it automatic in VS.
Thanks guys.
I'm frequently getting that as well. It really annoys me to go back to visual studio and change the line endings to Windows(CR LF) everytime it pops up. You can do that by clicking file menu and opening "advanced save options". If there's a way to set it as default, I'd like to hear it as well.
What is the answer for this? I am useing $$anonymous$$onoDevelop.
@Snownebula: Don't post such questions as answer. If you get that warning, that means your file(s) have mixed line endings. $$anonymous$$ac / Unix usually uses just a "line feed character" 0x0A and windows usually uses "carriage return" 0x0D and a "line feed" 0x0A together to mark the end of a line.
In some editors you can choose in the settings which line endings the editor should use when you make a new line. However those line endings which are already in the file aren't changed.
In $$anonymous$$onoDevelop you can set the desired line ending in the options.
Go to Tools -> Options -> Source Code -> Code Formatting -> TextFile
There you can choose which line endings $$anonymous$$onoDevelop will use from now on. Native will use the one the operating system is using by default.
What $$anonymous$$TheDev answer means:
When you create a new script in Unity, Unity uses the templates found in the folder he has mentioned. You should make sure that those templates are saved with the same line endings you're editor is using. Otherwise you get mixed line endings again.
Unfortunately $$anonymous$$onoDevelop doesn't have a function to "normalize" the line endings of a file. There are other editors which have such a function.
Answer by RudyTheDev · Feb 25, 2014 at 10:38 AM
Go to "\\Unity\\Editor\\Data\\Resources\\ScriptTemplates\\C# Script-NewBehaviourScript.cs.txt" and change it to your desired line endings.
I'm in that txt file right now, but I can't see how to "change it". Could you elaborate a bit?
You can usually select all, cut, then paste the entire text and that would do it. Your OS would (typically) change the newlines to use its own newline syntax. Then the pasted text will have those once you resave.
Failing that, you need a text editor that can show you exact line endings.
Bad answer since it will just do it again when you edit the file.
Answer by Mortalanimal · Jun 03, 2016 at 06:03 PM
In Visual Studio 2015:
Tool → Options → Environments → Documents → Check 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.
Thank you so much you really solved my problem the visual studio automatically solve such problem when we enable this. In visual studio 2017 it is automatically switched on.