I’ve just updated from FMOD 1.x to 2.00.03 and I’m seeing some fairly serious issues when the import mode is set to Asset Bundles.
- The FMOD banks are being deleted then copied into the Assets folder repeatedly every few seconds.
- All files that end in .bytes in the project are being deleted
This is due to faulty logic in EventManager.CopyToStreamingAssets.
This line is incorrect as it assumes that the files will be in streaming assets.
var targetShortName = RuntimeUtils.GetCommonPlatformPath(bankFileName).Replace(RuntimeUtils.GetCommonPlatformPath(Application.streamingAssetsPath + '/'), "");
Instead something like this might be better:
var targetShortName = RuntimeUtils.GetCommonPlatformPath(bankFileName).Replace(RuntimeUtils.GetCommonPlatformPath(bankTargetFolder), "");
But more fundamentally, the principle of searching for any .bytes files and deleting them if they don’t match the name of a bank seems entirely flawed. I get why that might make sense for a .banks file but it certainly doesn’t for a .bytes file that may contain any binary data used in the project.
This issue was exacerbated in this release by the addition of SearchOption.AllDirectories to this line:
string currentBankFiles = Directory.GetFiles(bankTargetFolder, "*." + bankTargetExension, SearchOption.AllDirectories);
This wasn’t there in 1.x which meant that at worst it would delete .bytes files in the Assets folder but not in any child directories.
All in all this approach seems dangerous and a bit lazy!