- Home /
Import DirectSound DLL
Hi everybody. I'm trying to import Microsoft.DirectX and Microsoft.DirectX.DirectSound DLLs in my project. Here is my code.
using UnityEngine; using System.Collections; using Microsoft.DirectX; using Microsoft.DirectX.DirectSound;
public class DetectSound : MonoBehaviour { void Start () { CaptureDevicesCollection devices = new CaptureDevicesCollection(); Debug.Log("Count: "+devices.Count); } } Here is the error.
MissingMethodException: Method contains unsupported native code Microsoft.DirectX.DirectSound.CaptureDevicesCollection..ctor () DetectSound.Start () (at Assets/Scripts/DetectSound.cs:10)This code is working on Visual Studio C# 2010 and result is 2. Also I'm using Unity Pro.
Answer by Dreamora · Jul 20, 2012 at 11:50 AM
This will not work. Unity does not use MS .NET but a custom Mono 2.6 version, as such you can't make use of features limited to MS.NET like anything in the Microsoft and the majority of the Windows namespaces.
To get a better feeling you might want to focus on learning Unity with monodevelop which out of the box will 'hide' those inexistant references. Its not as productive as using VS + R# or alike but at least wastes no time cause you rely on MS.NET exclusivities