x


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.

more ▼

asked Jul 20 '12 at 10:18 AM

BirhanDursun gravatar image

BirhanDursun
3 1 1 1

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

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 http://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 http://MS.NET exclusivities

more ▼

answered Jul 20 '12 at 11:50 AM

Dreamora gravatar image

Dreamora
3.2k 1 4 25

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x973
x233
x27
x6

asked: Jul 20 '12 at 10:18 AM

Seen: 524 times

Last Updated: Jul 20 '12 at 11:51 AM