Bank copy errors when using 2.0 integration

Okay, so I don’t see that error anymore but when the banks try to copy to the StreamingAssets folder, they are immediately deleted… Are these related?

We have seen this bug when using the AssetBundles option for importing the banks, but if you are using the StreamingAssets option then it is something new.

Are there any errors or warnings in the editor log file? (fmod_editor.log can be found in the project root folder)

hey Cameron,

we’re having a few of these bank copy problems testing macOS FMOD 2.00.04 and Unity 2019.2.4, multiple platforms selected with a relative build path to the built bank files.

The bank copying works for Desktop but fails when trying to switch a platform to use Mobile - it tries to copy the files inside the StreamingAssets folder by building a folder hierarchy matching the full path to the source files within the StreamingAssets folder (eg. a destination path like ‘Assets/StreamingAssets/Users/XXX/Development/ProjectName/FMODProject/Build/Mobile’).

Also, when trying to initialise with specific banks to load, after clicking ‘Add All Banks’ the list is populated with paths like ‘Desktop/BankA’ but StreamingAssets doesn’t have this path so the init loading fails. The banks are being copied to the root of StreamingAssets like 'StreamingAssets/BankA, not to a subfolder ‘StreamingAssets/DeskTop/BankA’. Is this intended, or should the content be copied to subfolders matching each platform name? Or. should the banks only exist in the root of StreamingAssets and the init bank settings are being populated incorrectly?

Changing the ‘Bank Platform’ settings for a platform (eg. Mobile) seems to blow the automatic bank file copying up with bad paths and missing banks, and general unhappiness. I’ve tried clearing the FMODStudioCache file a few times but this doesn’t fix things.

This does appear to be a bug, you should be able to manually delete the FMODStudioCache file to work around this for now. It is caused by the confusion between the old path and the new one.

The banks should be in the root directory, the bank settings (when using multi platform build) is populating the list incorrectly.

I have added tasks for these issues and hope to have them resolved in an upcoming release.

hey Cameron,

thanks for your reply.

I’ve been deleting the cache file which seems to then clear things up for the next build/copy. I’ve kept the banks in the root of the StreamingAssets folder and have been manually adding banks to load at initialisation.

I’ve also sent you a couple of minor pull requests on github for the Unity integration - a simple 2019.2 deprecation warning fix for Linux platforms and a doubled up instance.isValid check in the StudioEventEmitter.

cheers,

// greg

Getting the same problem with Plastic SCM. Was working fine with Unity Collaborate.

FMOD 2.00.1 Unity 2017.4.

Using Streaming Assets. Split between two users.

Deleting cache doesn’t solve the problem.

Not sure of how to fix this apart from going back to Unity Collaborate.

The issue was fixed in 2.00.03, updating to that or a newer version should fix the problem for you.

We just updated to v2.00.06 and the bank copying is trying to repeatedly copy the banks every few seconds which is causing problems while playing in the Editor.

The updated bank copying code calls ‘AssetDatabase.SaveAssets()’ which makes Unity save a bunch of things, including QualitySettings. The problem is that in play mode Unity removes quality settings for targets other than the current one (to emulate what would be there in a standalone runtime), which are then saved to disk in SaveAssets(), effectively deleting most of our quality settings every time we play in the Editor.

I will try to track down why FMOD EventManager is trying to copy the banks and save the AssetDatabase every few seconds.

Update: I cleared the cache, deleted the StreamingAssets banks etc. and it doesn’t help. FMOD is copying the banks and calling AssetDatabase.SaveAssets() every few seconds for every file while playing.

Update 2: To work around the problem, in EventManager.cs CopyToStreamingAssets() I moved the AssetDatabase.SaveAssets() call to inside the ‘madeChanges’ check at the end of the method;

// EventManager.cs CopyToStreamingAssets()
// ...
if (madeChanges)
{
    AssetDatabase.SaveAssets();
    AssetDatabase.Refresh();
    UnityEngine.Debug.Log(string.Format("FMOD Studio: copy banks for platform {0} : copying banks from {1} to {2} succeeded", platform.ToString(), bankSourceFolder, bankTargetFolder));
}
1 Like

Thanks very much for all the information, I had just found the cause of the CopyToStreamingAssets triggering constantly thanks to another thread:

Moving the SaveAssets looks like a good idea too, I’ll get this change added for the next release as well.

Updating from 2.00.01 to 2.00.06 solved the problem for me. Worked first time by following the ‘upgrade version’ documentation. We were using Plastic SCM for version control.

1 Like

I had the same problem with:
FMOD 2.00.06
Unity 2019.2.16f1

Adding @nzgreg 's fix to EventManager.cs line 583 fixed it for me too.

    foreach (var bankRef in eventCache.EditorBanks)
    {
        // ...
        if (madeChanges) {
            AssetDatabase.SaveAssets();
        }
    }