# About make plugin to unity package and modify FMODStudioSettings

**URL:** <https://qa.fmod.com/t/about-make-plugin-to-unity-package-and-modify-fmodstudiosettings/20597>\
**Category:** Unity\
**Tags:** unity, csharp\
**Created:** [August 25, 2023, 11:53am UTC](https://qa.fmod.com/t/about-make-plugin-to-unity-package-and-modify-fmodstudiosettings/20597 "2023-08-25T11:53:51Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![MisakaCirno](https://avatars.discourse-cdn.com/v4/letter/m/e480ec/32.png) [@MisakaCirno](https://qa.fmod.com/u/MisakaCirno)\
**Post date:** [August 25, 2023, 11:53am UTC](https://qa.fmod.com/t/about-make-plugin-to-unity-package-and-modify-fmodstudiosettings/20597/1 "2023-08-25T11:53:51Z")

</div>

To make it easier to manage and to add some of the features I needed, I referenced the following:

1. [Support for custom Unity packages - Unity - FMOD Forums](https://qa.fmod.com/t/support-for-custom-unity-packages/18753)
2. [FMOD - User Guide (plugin file locations)](https://fmod.com/docs/2.02/unity/user-guide.html#plugin-file-locations)

Made the plugin into a unity package and stored it in a git repository, but a problem arose.

If a package is added from git, then all its files are stored under the `Library\PackageCache` path and all files are read-only.  
However, if you want to use the FMOD plugin, you must need to modify the `FMODStudioSettings.asset` file in it.  
What should I do about this problem that causes conflicts? Do I need to modify the plugin’s code to adjust the path to find the `FMODStudioSettings.asset` file?

---

<div class="post-metadata">

**Author:** ![MisakaCirno](https://avatars.discourse-cdn.com/v4/letter/m/e480ec/32.png) [@MisakaCirno](https://qa.fmod.com/u/MisakaCirno)\
**Post date:** [August 28, 2023, 2:42am UTC](https://qa.fmod.com/t/about-make-plugin-to-unity-package-and-modify-fmodstudiosettings/20597/2 "2023-08-28T02:42:16Z")

</div>

One more question, does `name` in `package.json` have to be  
`com.firelight.fmod-for-unity` ?

---

<div class="post-metadata">

**Author:** ![MisakaCirno](https://avatars.discourse-cdn.com/v4/letter/m/e480ec/32.png) [@MisakaCirno](https://qa.fmod.com/u/MisakaCirno)\
**Post date:** [August 28, 2023, 8:56am UTC](https://qa.fmod.com/t/about-make-plugin-to-unity-package-and-modify-fmodstudiosettings/20597/3 "2023-08-28T08:56:24Z")

</div>

I noticed a few details:  
When I import the `.unitypackage` file, there are a total of 6 folders under the `Assets` path, `addons`, `images`, `obsolete`, `platforms`, `src` and `staging`.

But when I import, `obsolete`, `staging` and `platforms\mac` files are not imported.  
And the `Cache` and `Resources` folders are automatically created.

Should `obsolete`, `staging`, and `platforms\mac` files all be packaged in the package as well?  
Should `Cache` and `Resources` be ignored?

---

<div class="post-metadata">

**Author:** ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)\
**Post date:** [August 29, 2023, 1:28am UTC](https://qa.fmod.com/t/about-make-plugin-to-unity-package-and-modify-fmodstudiosettings/20597/4 "2023-08-29T01:28:26Z")

</div>

The `FMODStudioSettings.asset` is a generated file needs to be able to be modified, so it would be best not to add this to the git repo. Unity should make a local version that it can modify as needed.

> [@MisakaCirno](#):
>
> does `name` in `package.json` have to be `com.firelight.fmod-for-unity` ?

No, it doesn’t _need_ to be `com.firelight.fmod-for-unity`. This is the naming convention that Unity use for the UPM but the integration doesn’t rely on that particular folder name.

> [@MisakaCirno](#):
>
> Should `obsolete`, `staging`, and `platforms\mac` files all be packaged in the package as well?  
> Should `Cache` and `Resources` be ignored?

The folders `obsolete` and `staging` are only used for updating the integration, it will attempt to replace older versions of certain files and then either move or delete them from these folders. You can ignore these as they are not meant to hang around after the initial editor compilation.

`Cache` and `Resources` will only contain files that are generated locally, depending on the settings in Unity. They should not be added otherwise, as mentioned in your original post, they will be read-only.

As for the `platforms/mac` folder, it should contain libs and source files but if you aren’t using mac (same goes for other platforms) then you do not need to include them.

* * *

It seems like this is something we should specify in our documentation, so I will create a task to add it.

You basically want to include the FMOD folder, then ignore the `Cache` and `Resources` folders. All the other folders and files should be added to the repo.

---

<div class="post-metadata">

**Author:** ![MisakaCirno](https://avatars.discourse-cdn.com/v4/letter/m/e480ec/32.png) [@MisakaCirno](https://qa.fmod.com/u/MisakaCirno)\
**Post date:** [August 29, 2023, 3:09am UTC](https://qa.fmod.com/t/about-make-plugin-to-unity-package-and-modify-fmodstudiosettings/20597/5 "2023-08-29T03:09:43Z")

</div>

Thanks for the reply, I think I need to describe a bit more the results of my current quest.

First is my purpose, I want to convert FMOD into a Unity Package and version control it via Git.

* * *

After following the steps provided in the documentation so far, I was able to successfully make the Unity Package.  
After I uploaded it to Git, I was also able to install it by adding a git URL to UPM.

However, it seems that for Unity, if a Unity Package is installed via a git URL, all of its files will be placed in the `{ProjectName}\Library\PackageCache` directory, and all of the files there will not be editable via the Unity Editor.

I tried ignoring the `Cache` and `Resources` folders and leaving them out of the Unity Package, but this causes Unity to output a lot of Warnings in the Console.

I noticed that you mentioned

> `Cache` and `Resources` will only contain files that are generated locally, depending on the settings in Unity.

But I tried and couldn’t find anything like that, can you provide more information?

* * *

Also, if you add the Unity Package to git, it prompts a message after installation. I found two posts in the forum for the same issue:

1. [Incorrect line endings in Fmod plugin bundles - FMOD Studio - FMOD Forums](https://qa.fmod.com/t/incorrect-line-endings-in-fmod-plugin-bundles/18791/2)
2. [Repair FMOD Libraries warning still keeps showing after click repair button - Unity - FMOD Forums](https://qa.fmod.com/t/repair-fmod-libraries-warning-still-keeps-showing-after-click-repair-button/18213)

I followed the instructions in the posts and added the `.gitattributes` file, but still have the same problem.

I double-checked, through the Unity Console messages, and comparing the folders, and realized that it was not the three folders:

- Packages/{UnityPackageName}/FMOD/platforms/mac/lib/fmodstudio.bundle
- Packages/{UnityPackageName}/FMOD/platforms/mac/lib/fmodstudioL.bundle
- Packages/{UnityPackageName}/FMOD/platforms/mac/lib/resonanceaudio.bundle

Instead, it was the three files:

- 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

So I changed the contents of the `.gitattributes` file to `*.plist text eol=lf`.

But the problem is still not solved.  
I double-checked the files again and found that the local files were `LF,` uploaded to git and then downloaded were still `LF,` and for some reason installing via UPM made them `CRLF` first (in `{ProjectName}\Library\PackageCache` folder).

So I’m not sure if the problem belongs to FMOD, or Git, or UPM.

* * *

Regardless of the outcome, thanks again for your reply.

---

<div class="post-metadata">

**Author:** ![MisakaCirno](https://avatars.discourse-cdn.com/v4/letter/m/e480ec/32.png) [@MisakaCirno](https://qa.fmod.com/u/MisakaCirno)\
**Post date:** [August 30, 2023, 10:31am UTC](https://qa.fmod.com/t/about-make-plugin-to-unity-package-and-modify-fmodstudiosettings/20597/6 "2023-08-30T10:31:20Z")

</div>

I’m back to share my new research.  
After analyzing the code, I found that the paths to the Resources and Cache folders are determined based on these properties:

- `FMODUnity.RuntimeUtils.BaseFolderGUID`
- `FMODUnity.RuntimeUtils.PluginBasePathDefault`
- `FMODUnity.RuntimeUtils.PluginBasePath`

Just modify the appropriate section and you can use it.  
Example:

- `FMODUnity.CreateSettingsAsset()` method - `FMODStudioSettings.asset` file.
- `FMODUnity.EventManager.CacheAssetFullName` property - `FMODStudioCache.asset` file.

* * *

But I still haven’t solved the problem about `LF` and `CRLF`.

---

<div class="post-metadata">

**Author:** ![MisakaCirno](https://avatars.discourse-cdn.com/v4/letter/m/e480ec/32.png) [@MisakaCirno](https://qa.fmod.com/u/MisakaCirno)\
**Post date:** [August 31, 2023, 8:58am UTC](https://qa.fmod.com/t/about-make-plugin-to-unity-package-and-modify-fmodstudiosettings/20597/7 "2023-08-31T08:58:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)\
**Post date:** [September 11, 2023, 3:40am UTC](https://qa.fmod.com/t/about-make-plugin-to-unity-package-and-modify-fmodstudiosettings/20597/8 "2023-09-11T03:40:34Z")

</div>

Thanks for all the information, I’ve made a task to investigate this further.
