I found unity will use both LF and CRLF as line ends for assets file serialization. For example, I have a scriptableobject saved on disk with CRLF before, after one day, I found unity will use LF to serialize it to disk. It results that I will see diff in version control like svn and git even there is only line ends different.
It will slow down our workflow cause we will check one by one whether the modify is meaningful and it will also conflict with other people’s modify.
So I want know whether there is a switch for line ends for serialization?
I’m using 2020.3.17f1 on windows 10.
5 Likes
We are also seeing this, with the exact same Unity version coincidentally. Certain prefabs seem to get flagged to be written to disk only after playing our game in the editor. The only changes are line endings.
Thing is, with one of the prefabs (prefab A, say), once the line endings have changed, we get “Missing Prefabs” in other prefabs in which prefab A is nested. No guids have changed anywhere. I don’t know if there’s some checksum validation that failing after the line endings change. Very weird. If I revert the line ending changes to prefab A, that fixes the missing prefabs.
So as far as i can see, there are 3 issues:
- Seemingly unnecessary writing of prefab to disk.
- Not preserving line endings of existing file.
- Somehow breaking nested prefab refs after line ending change.
In my case, Unity also uses both LF and CRLF for assets. Sometimes it changes one line ending with another. This leads to additional changes in the VCS and additional conflicts when merging assets. And I don’t understand how to set certain line ending for all my assets forever.
Unity 2022.1.14
1 Like
We’re plagued with this issue on Unity 2023.2.6f1
1 Like
Great news, waiting for 2023 LTS.