So heres an issue that I’ve had with Unity for a long time. Ever create a new script, add some variables and functions to it and hit save, then all of a sudden Unity and Visual Studio are complaining about the line ending being a mix of linux and windows style? Well apparently its still an issue, but there is an easy fix for it now.
Back in the day, the only fix was to navigate into some weird folders hidden inside your Unity installation, and then manually edit all the template files for different types of scripts you will use and convert the line endings in them to your desired format.
However, there’s seems to be a quicker fix nowadays, and its built into Unity itself. Now why is this issue not fixed automatically? Who knows. Probably because most of the Unity devs most likely use Macs and so aren’t directly affected by this. But for the rest of us poor folk who either can’t afford a Mac or choose not to use one for moral reasons, it can be a bit of a pain.
But anyways here is the solution:
- In Unity goto Edit -> Project Settings-> Editor
- At the bottom of the list change the Line Endings for New Scripts Mode from Linux to Windows. You could also try OS Native.
And voila, you might not get line ending errors anymore, at least for new files.
This is where I found the solution.
Well good luck and thanks for coming.