xenolightning / AudioSwitcher

.NET Library which facilitates interacting with Audio Devices on Windows
Microsoft Public License
248 stars 53 forks source link

CoreAudioController constructor results in method access exception - Unity3D #60

Closed ericsantos147 closed 3 years ago

ericsantos147 commented 3 years ago

MAE

The following is the error when calling the CoreAudioConstructor:

System.MethodAccessException: Method System.__ComObject..ctor()' is inaccessible from methodSystem.ComObject..ctor()' at (wrapper managed-to-native) System.Object.icall_wrapper_mono_throw_method_access(intptr,intptr) at System.ComObject..ctor () [0x00000] in :0 at (wrapper cominterop-invoke) System.ComObject..ctor() at (wrapper managed-to-native) System.Reflection.MonoCMethod.InternalInvoke(System.Reflection.MonoCMethod,object,object[],System.Exception&) at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00002] in :0

xenolightning commented 3 years ago

This isn't tested for the mono runtime or running within Unity.

My thoughts are that it probably shouldn't be run inside Unity.

Looks like there's general issues with PInvoke calls from Unity - might be better to use a C++ library to do what you need