Answered
0
0

If I enable debugging with Visual Studio + Unity (2017), the moment I hit a breakpoint, Unity freezes and I have to do a forced restart. If I delete FMOD from the project everything works fine.

I found this piece of information in the VS documentation that MIGHT be the way to fix it:
https://docs.microsoft.com/en-us/visualstudio/cross-platform/troubleshooting-and-known-issues-visual-studio-tools-for-unity

Several Unity plugins like Parse, FMOD, UMP (Universal Media Player), ZFBrowser or Embedded Browser are using native threads. It’s an issue when a plugin ends up attaching a native thread to the runtime, which then does blocking calls to the OS. This means Unity can’t interrupt that thread for the debugger (or domain reload) and hang.

For FMOD, there is a workaround, you can pass FMOD_STUDIO_INIT_SYNCHRONOUS_UPDATE initialization flag to disable asynchronous processing and perform all processing on the main thread.

Unfortunately, I have no idea where in my code I should be setting up the FMOD_STUDIO_INIT_SYNCHRONOUS_UPDATE flag…

So if that is the issue :
1. How do I change that flag during initialization (when is that exactly?)?
2. What is the right way to pass the value using the FMOD.Studio.System.initialize()?

And if the issue is something different, any suggestions/help?

  • You must to post comments
Best Answer
1
0

Unfortunately this has been an issue for some time now when trying to debug native callbacks.

You can add that flag to the studioInitFlags found in the RuntimeManager.cs Initialize().

FMOD.Studio.INITFLAGS studioInitFlags = ... | FMOD_STUDIO_INIT_SYNCHRONOUS_UPDATE;
  • You must to post comments
0
0

Kinda what I suspected, thanks @Cameron. This is what I ended up doing so it works in the editor and I can still have it work in a exported build:
`
FMOD.Studio.INITFLAGS studioInitFlags;

#if UNITY_EDITOR
//FIX FOR CRASHES
studioInitFlags = FMOD.Studio.INITFLAGS.SYNCHRONOUS_UPDATE;
#else
//ORIGINAL LINE
studioInitFlags = FMOD.Studio.INITFLAGS.NORMAL | FMOD.Studio.INITFLAGS.DEFERRED_CALLBACKS;
#endif
`

I wonder if it will ever be properly fixed…

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.