Unity Version : 2021.3.27f1
I’m trying to make the FMOD plugin a Unity Package to manage it.
FMOD plugin: FMOD for Unity | Audio | Unity Asset Store
But when I upload it to a git repository, some of the files in it will use CRLF instead of LF if installed via a git URL.
Is this a UPM issue? Maybe the LF is converted to CRLF during the download process?
The file where this problem occurs is:
- Packages/{UnityPackageName}/FMOD/platforms/mac/lib/fmodstudio.bundle/Contents/Info.plist
- Packages/{UnityPackageName}/FMOD/platforms/mac/lib/fmodstudioL.bundle/Contents/Info.plist
- Packages/{UnityPackageName}/FMOD/platforms/mac/lib/resonanceaudio.bundle/Contents/Info.plist
Also, fmodstudio.bundle, fmodstudioL.bundle, and resonanceaudio.bundle have .bundle as an extension, but they are actually three folders.
Instead, when viewed in the Unity Editor, these three folders are treated as three .asset files.
I noticed that there are threads in the forums talking about a similar issue, but no one has replied. Can anyone come up with an answer to this question?
Unity + Git .asset files do not have CRLF line endings - Unity Forum
You can configure git how deal with line endings. I believe the default is to convert to CRLF probably because it‘s the most compatible. Check the git manual. If you use a Git GUI tool like SourceTree you may find this in its options.
In fact that’s what I presumed at first.
But I had already configured the .gitattributes file and set *.plist text eol=lf in it.
After my testing (opening the file via VSCode to see if it’s LF):
- Locally I am using LF for these files.
- When I uploaded them to git and fetched them down again, they were still LF.
- After I download the zip file from git and unzip it. The file is also LF.
In all three of these cases, there is no prompt when using Add package from disk.
But as soon as the package is installed from the git URL, these files just installed down are CRLF (in the Library\PackageCache\com.myname.fmod@commit_hash).
I think I found the problem.
Unity actually adjusts the downloaded files based on the .gitattributes file.
And the way I installed it is: http://gitlab.xxxxx.com/unitypackage_pub/fmod.git?path=com.xxxxx.fmod#1.x.x
This causes UPM to download a Package without the .gitattributes, thus using the default processing to change all the files to CRLF.
The solution is also simple, just move the .gitattributes file to the com.xxxxx.fmod folder.
1 Like