# Unity Integration: Error “Failed to get number of recording devices” with FMOD Studio 2.02.07

**URL:** <https://qa.fmod.com/t/unity-integration-error-failed-to-get-number-of-recording-devices-with-fmod-studio-2-02-07/20806>\
**Category:** Unity\
**Created:** [October 25, 2023, 11:13am UTC](https://qa.fmod.com/t/unity-integration-error-failed-to-get-number-of-recording-devices-with-fmod-studio-2-02-07/20806 "2023-10-25T11:13:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Merlinmonad](https://avatars.discourse-cdn.com/v4/letter/m/a587f6/32.png) [@Merlinmonad](https://qa.fmod.com/u/Merlinmonad)\
**Post date:** [October 25, 2023, 11:13am UTC](https://qa.fmod.com/t/unity-integration-error-failed-to-get-number-of-recording-devices-with-fmod-studio-2-02-07/20806/1 "2023-10-25T11:13:44Z")

</div>

Hello,

We are currently facing an issue with FMOD Studio 2.02.07 our Unity project (version 2021.3.14f1). The problem seems to be with the microphone functionality, even though we are not using any microphones in our application.

Issue Description:

We are consistently encountering an error message that reads: “Failed to get number of recording devices: ‘An invalid object handle was used.’ (36)”. This issue occurs four times; twice when logging into our game and twice when quitting playmode.

Error Callstacks:

Here are the callstacks associated with the error messages:

On Logging into the Game:

## Failed to get number of recording devices: "An invalid object handle was used. " (36) 0x00007ff7e90facbd (Unity) StackWalker::GetCurrentCallstack 0x00007ff7e9101999 (Unity) StackWalker::ShowCallstack 0x00007ff7ea0688a3 (Unity) GetStacktrace 0x00007ff7ea70797d (Unity) DebugStringToFile 0x00007ff7e9511228 (Unity) AudioManager::ValidateFMODResult 0x00007ff7e9502405 (Unity) AudioManager::GetMicrophoneDeviceIDFromName 0x00007ff7e845624c (Unity) Microphone\_CUSTOM\_GetMicrophoneDeviceIDFromName 0x000002ce4c810bca (Mono JIT Code) (wrapper managed-to-native) UnityEngine.Microphone:GetMicrophoneDeviceIDFromName (string) 0x000002ce4c810a13 (Mono JIT Code) UnityEngine.Microphone:End (string) 0x000002ce4c81077b (Mono JIT Code) [AudioCapture.cs:51] Inworld.AudioCapture:StopRecording () 0x000002ce4c7cb93b (Mono JIT Code) [InworldController.cs:211] Inworld.InworldController:OnDisable () 0x000002ce4c83f4c8 (Mono JIT Code) (wrapper runtime-invoke) object:runtime\_invoke\_void\_\_this\_\_ (object,intptr,intptr,intptr) 0x00007ffc9c23feb4 (mono-2.0-bdwgc) [mini-runtime.c:3445] mono\_jit\_runtime\_invoke 0x00007ffc9c17e764 (mono-2.0-bdwgc) [object.c:3066] do\_runtime\_invoke 0x00007ffc9c17e8fc (mono-2.0-bdwgc) [object.c:3113] mono\_runtime\_invoke 0x00007ff7e901f644 (Unity) scripting\_method\_invoke 0x00007ff7e8ffeee4 (Unity) ScriptingInvocation::Invoke 0x00007ff7e8ffefce (Unity) ScriptingInvocation::InvokeChecked 0x00007ff7e9093f66 (Unity) SerializableManagedRef::CallMethod 0x00007ff7e8ff1872 (Unity) MonoBehaviour::RemoveFromManager 0x00007ff7e89abbf7 (Unity) GameObject::ActivateAwakeRecursivelyInternal 0x00007ff7e89ab809 (Unity) GameObject::ActivateAwakeRecursively 0x00007ff7e89ae4c9 (Unity) GameObject::Deactivate 0x00007ff7e8cc0135 (Unity) DestroyObjectHighLevel\_Internal 0x00007ff7e8cc3401 (Unity) UnloadGameScene 0x00007ff7e8d1ea4a (Unity) LoadSceneOperation::PlayerLoadSceneFromThread 0x00007ff7e8d1ca43 (Unity) LoadSceneOperation::IntegrateMainThread 0x00007ff7e8d20711 (Unity) PreloadManager::UpdatePreloadingSingleStep 0x00007ff7e8d20cef (Unity) PreloadManager::WaitForAllAsyncOperationsToComplete 0x00007ff7e8d20286 (Unity) PreloadManager::UpdatePreloading 0x00007ff7e8ceef73 (Unity) `InitPlayerLoopCallbacks'::`2’::EarlyUpdateUpdatePreloadingRegistrator::Forward 0x00007ff7e8cd614a (Unity) ExecutePlayerLoop 0x00007ff7e8cd62d6 (Unity) ExecutePlayerLoop 0x00007ff7e8cdc389 (Unity) PlayerLoop 0x00007ff7e9c205a9 (Unity) PlayerLoopController::UpdateScene 0x00007ff7e9c1e7ab (Unity) Application::TickTimer 0x00007ff7ea06ea3a (Unity) MainMessageLoop 0x00007ff7ea0732fb (Unity) WinMain 0x00007ff7eb414fbe (Unity) \_\_scrt\_common\_main\_seh 0x00007ffd2d627344 (KERNEL32) BaseThreadInitThunk 0x00007ffd2ebe26b1 (ntdll) RtlUserThreadStart

On Quitting Playmode:

## Failed to get number of recording devices: "An invalid object handle was used. " (36) 0x00007ff7e90facbd (Unity) StackWalker::GetCurrentCallstack 0x00007ff7e9101999 (Unity) StackWalker::ShowCallstack 0x00007ff7ea0688a3 (Unity) GetStacktrace 0x00007ff7ea70797d (Unity) DebugStringToFile 0x00007ff7e9511228 (Unity) AudioManager::ValidateFMODResult 0x00007ff7e9502405 (Unity) AudioManager::GetMicrophoneDeviceIDFromName 0x00007ff7e845624c (Unity) Microphone\_CUSTOM\_GetMicrophoneDeviceIDFromName 0x000002ce4657bf2a (Mono JIT Code) (wrapper managed-to-native) UnityEngine.Microphone:GetMicrophoneDeviceIDFromName (string) 0x000002ce4657bc43 (Mono JIT Code) UnityEngine.Microphone:End (string) 0x000002ce4657ba6b (Mono JIT Code) [AudioCapture.cs:51] Inworld.AudioCapture:StopRecording () 0x000002ce465766fb (Mono JIT Code) [InworldController.cs:211] Inworld.InworldController:OnDisable () 0x000002ce1944e4a8 (Mono JIT Code) (wrapper runtime-invoke) object:runtime\_invoke\_void\_\_this\_\_ (object,intptr,intptr,intptr) 0x00007ffc9c23feb4 (mono-2.0-bdwgc) [mini-runtime.c:3445] mono\_jit\_runtime\_invoke 0x00007ffc9c17e764 (mono-2.0-bdwgc) [object.c:3066] do\_runtime\_invoke 0x00007ffc9c17e8fc (mono-2.0-bdwgc) [object.c:3113] mono\_runtime\_invoke 0x00007ff7e901f644 (Unity) scripting\_method\_invoke 0x00007ff7e8ffeee4 (Unity) ScriptingInvocation::Invoke 0x00007ff7e8ffefce (Unity) ScriptingInvocation::InvokeChecked 0x00007ff7e9093f66 (Unity) SerializableManagedRef::CallMethod 0x00007ff7e8ff1872 (Unity) MonoBehaviour::RemoveFromManager 0x00007ff7e89abbf7 (Unity) GameObject::ActivateAwakeRecursivelyInternal 0x00007ff7e89ab809 (Unity) GameObject::ActivateAwakeRecursively 0x00007ff7e89ae4c9 (Unity) GameObject::Deactivate 0x00007ff7e8cc0135 (Unity) DestroyObjectHighLevel\_Internal 0x00007ff7e8cbfd84 (Unity) DestroyObjectHighLevel 0x00007ff7e8cca6be (Unity) DestroyWorldObjects 0x00007ff7e9efe8e1 (Unity) EditorSceneManager::RestoreSceneBackups 0x00007ff7e9c0bb8d (Unity) PlayerLoopController::ExitPlayMode 0x00007ff7e9c1b641 (Unity) PlayerLoopController::SetIsPlaying 0x00007ff7e9c1ea39 (Unity) Application::TickTimer 0x00007ff7ea06ea3a (Unity) MainMessageLoop 0x00007ff7ea0732fb (Unity) WinMain 0x00007ff7eb414fbe (Unity) \_\_scrt\_common\_main\_seh 0x00007ffd2d627344 (KERNEL32) BaseThreadInitThunk 0x00007ffd2ebe26b1 (ntdll) RtlUserThreadStart

I am not a dev, just the audio guy. I would greatly appreciate any guidance or solutions you could provide to resolve this. Is this a known issue with FMOD Studio 2.02.07 and Unity 2021.3.14f1? Are there any patches or workarounds available to address this problem?

Thank you very much for your time!

Best Regards,

Merlin

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [October 25, 2023, 11:45pm UTC](https://qa.fmod.com/t/unity-integration-error-failed-to-get-number-of-recording-devices-with-fmod-studio-2-02-07/20806/2 "2023-10-25T23:45:00Z")

</div>

Hi,

Thank you for the call stack.

Unfortunately, this is Unity using an outdated version of the FMOD Core API in their `Microphone.Start()` function. The only reference to FMOD is the `ValidateFMODResult` call.

Are your devs using the FMOD Integration in the Unity project? If so, you can point them toward this scripting example: [Unity Integration | Scripting Examples - Record](https://fmod.com/docs/2.02/unity/examples-record.html) which outlines using the FMOD system to record microphone input in Unity.

Hope this helps!
