FMOD Unity Integration 1.07.03 fails on Windows Build

Hi,

I just switched to the new version of FMOD from the 1.06 one.
It works perfectly on Android builds and in the Unity Editor, but on Windows builds I get the error “DllNotFoundException: …/Plugins/fmodstudiol.dll” every time I try to play a sound. I manually checked the build and the .dll files are there in the path specified in the error msg.

I tried “reinstaling” FMOD multiple times, tried to manually copy the .dll files from the unity project to the Windows build folder. Tried if there is an issue with 32/64 bit builds. Nothing so far fixed the problem.

Any idea what might be causing this issue?

The sound designer works on OSX and I use Windows. Might there be a problem with .banks being build on OSX and then used on Windows?

Continued trying out different things.
Found out that the windows build actually works, but only when you turn on “development build” AND “script debugging” in the Build Settings… Really strange behavior, but maybe it gives you a clue what might be happening.

This will be fixed in 1.07.04. You can apply the fix now by editing the Start and Update methods of StudioEventEmitter

    private bool firstUpdate = true;

    void Start() 
    {                   
        cachedRigidBody = GetComponent<Rigidbody>();
    }

~

    void Update()
    {
        if (firstUpdate)
        {
            enabled = false;
            HandleGameEvent(EmitterGameEvent.LevelStart);
            firstUpdate = false;
        }

        if (instance != null)
        {
            instance.set3DAttributes(RuntimeUtils.To3DAttributes(gameObject, cachedRigidBody));
            FMOD.Studio.PLAYBACK_STATE state;
            instance.getPlaybackState(out state);
            if (state == FMOD.Studio.PLAYBACK_STATE.STOPPED)
            {
                instance.release();
                instance = null;
                enabled = false;
            }
        }
    }

Although you say it would be fixed with 1.07.04 I still experience the same issue with a development build of my game using the specified version (and Unity 5.3.1).
FMOD keeps printing the exception to the debug console (which makes it useless to see any other exception messages).
The source of StudioEventEmitter.cs looks the same (on Start and Update methods) to me.
Running in Editor does so without any problems, and so far no crashes occur in non-dev builds (but I can’t check if any exception occur as none are printed).
So it seems to me that there is a bit more to this issue than a few lines of code.

Would be great if someone could get into this again.
Kind Regards
Tobias

Addendum: I’ve tested a few build options variations (dev-build, script debug, auto-connect profiler) and so far the exception is thrown only when I have dev-build and auto connect profiler switched on. As soon as I check script debugging it does not occure anymore. I’m not sure what the script debugging does or changes to an build but it keeps the console clean ^^).
So in case you experience the same issue, you might consider checking script debugging on the build settings =).

1 Like

This is also happening to me too, not sure what the problem is but no one seems to have a fix that doesn’t involve the script debugging.

This is all trying to work around a Unity bug that I’ve reported but has been ignored by Unity. Tobias - you say you still get DllNotFound in StudioEventEmitter.Start - but my changes in 1.07.04 remove all FMOD calls from Start. What code in Start() is generating the exception?

1.07.05 has more fixes for issues that have been found that can lead to the DllNotFound exception.

Same problem here.
The game works fine on the unity editor but on the windows build we get the error “DllNotFoundException:…/Plugins/fmodstudiol.dll”.
The error appears randomly: sometimes at startup, sometimes it’s possible to play for a while without any problem.
Everything works fine if we turn on “script debugging” on the build settings.
We are using FMOD 1.07.06 and unity 5.3.2.

Can you give more details: is it the same build that randomly fails, or will random builds fail consistently?

I’ve been getting the exact same issue, however I found a fix by switching my build to x86 only rather than x86_64. I’m running Unity 5.3.1p4 FMOD 1.07.06. Sorry to not be more helpful, although this might help narrow down the issue.

Unity just fixed this Unity 5.3.4p3. We released a workaround in 1.08.01. They also list a different workaround on their bug description page.

We’ve made more tests.
Every build that we make has the same problems (if “script debugging” is turned off) but the error does not seem to be random.
We’ve noticed that the crash is caused by FMOD.Studio.EventInstance.stop or FMOD.Studio.ParameterInstance.setValue but the game does not crash at the first stop or setParam but the error seems related to particular sequences of events and we are able to reproduce it every time.

Can you email support@fmod.com with your repro case. Send an email even if you can’t give us a repro, I’ll send you something to try and fix the issue.

I also am running into this issue. Works in Unity Editor, but a standalone windows build results in the DllNotFoundException.

I read somewhere else that this is because start() is called on an EventInstance before FMOD is completely ready. The test was to delay calling start() for 10-20 seconds, and it worked for them.

For me, I tried a 5 second delay before calling start(), and it seemed to work for me as well.

Note I was able to call FMODUnity.RuntimeManager.CreateInstance(id) in my Monobehaviour::Start() function, but calling start() on my EventInstance here resulted in the DllNotFoundException.

Can FMOD expose a callback function to notify Unity when FMOD is ready to use? Or something like, an IsReady() check, to make sure Unity code waits for FMOD to initialize?

I saw FMODUnity.RuntimeManager.StudioSystem.setCallback(), but have not yet tried it, and am not certain this reports the “ready” event that we need.

There is no concept of “FMOD Ready” for us to expose. There have been a few legitimate bugs in FMOD Integration script that caused this error in the past, but there are also Unity bugs - otherwise why would one function contained in fmodstudio.dll work than calling a second function in the same DLL fail?

Can you clarify: Your Integration version, your Unity version, what build settings you use on your standalone builds.

FMOD Studio 1.07.7, Unity 5.3.1f1, targeting Windows x64 with Dev Build set. I have not tried with Autoconnect Profiler or Script Debugging checked, as the results of those settings are already reported above. But if it helps, I can report back with my own findings for these settings…

It sounds like you’ve got the exact same issues as the other recent posters. Use script debugging if you turn development build on.