Search Unity

Unity can't "find" managed class in dll

Discussion in 'Scripting' started by Frostraver, Oct 21, 2015.

  1. Frostraver

    Frostraver

    Joined:
    Oct 26, 2012
    Posts:
    25
    I've compiled a C++ DLL using Visual Studio 2015 that contains an unmanaged class with a managed class that wraps the unmanaged one.
    Now, I can use the class in C# if I add it as a reference to the project in Visual Studio but Unity can't seem to find the managed class in the dll.

    Is there anything I need to add or change so that Unity can find the managed class?

    This is how the managed class looks in the dll:

    Code (CSharp):
    1. #using <mscorlib.dll>
    2. #include "PortAudioManager.h"
    3. using namespace System;
    4.  
    5. public ref class PortAudioManaged
    6. {
    7. private:
    8.     PortAudioManager* audioManager;
    9. public:
    10.     PortAudioManaged() : audioManager(new PortAudioManager()) {
    11.     }
    12.  
    13.     virtual ~PortAudioManaged() {
    14.         this->!PortAudioManaged();
    15.     }
    16.  
    17.     // = Object.Finalize
    18.     !PortAudioManaged() {
    19.         delete audioManager;
    20.         audioManager = nullptr;
    21.     }
    22.  
    23.     void openStreamManaged() {
    24.         audioManager->openStream();
    25.     }
    26.  
    27.     void stopStreamManaged() {
    28.         audioManager->stopStream();
    29.     }
    30. };