Issue with StreamingAssets copy when running Unity in batchmode

Hi,

I recently added the FMOD Studio Unity integration to our project and it has all been working great apart from one thing, our automated builds are missing all of the soundbanks.

Our project is set up to use the “Streaming Assets” import type, and is linked to the fmod project via the project file path. This all works correctly when running in the editor, switching platforms and making builds from the editor, in all of these cases the banks are copied over to StreamingAssets as expected.

Our automated build process runs Unity with the -batchmode commandline parameter and a custom build script executed via -executeMethod. It’s the batchmode parameter that seems to be what is causing the copy step to fail, the banks and StreamingAssets folder are missing from both the Assets directory and the build output in these builds. I’ve worked around this for now by calling FMODUnity.EventManager.UpdateCache() and FMODUnity.EventManager.CopyToStreamingAssets() from our build script before it makes the player build, but it seems like a bit of a hack. I think the issue is that the EditorApplication.Update event used in the EventManger script doesn’t seem to ever get triggered when running Unity in batchmode, so this copy step never runs as it usually would.

Is this a known issue? Is my workaround going to be sufficient to solve this?

ps. I’m running Unity 5.6.1p1 and Fmod integration 1.09.05, and the builds I’m making are all Win64 builds.

Cheers,
James

You are correct, because the editor doesn’t launch the Editor scripts don’t run.
We have only been made aware that this is an issue once before, and we came to the conclusion that manually calling UpdateCache & CopyToStreamingAssets (as you have suggested) is going to be required.

1 Like

Thanks Cameron, I’ll keep doing it this way then (seems to be holding up OK so far)

Hey James, we seem to be running into the same problem, but it seems that on UpdateCache() it exits out because the countdownTimer is > 0 (countdownTimer == 3 specifically). So we’re left with no banks/without a streamingassets folder in our build. Did you run into this?

Fixed this on my project, and want to help out.
In EventManager.UpdateCache, find the line that says:

if (countdownTimer-- > 0)

and change it to:

if (countdownTimer-- > 0 && !Application.isBatchMode)

This will skip the return check. Then, from your build script call UpdateCache & CopyToStreamingAssets as you were doing. This necessitates that you are not editing your banks in fmod studio while this batchmode build is running.

I’d love to see a real fix for this in future integrations, please! (I’m on the latest as of Feb 2019 and it’s still an issue).

Thanks for the feedback, we will look into this further.

Thanks. Another nice-to-have would be to skip the “last modified” checks in batchmode, ensuring that the bank state in the project matches the fmod project build folder exactly.

That seems like it would be a good idea.

These changes will be available in the next release (1.10.12).