Oct 8, 2013

[Unity3d] How to use C++ dll in Unity3d

1. Make CLI  Class library project in Visual Studio. 


2.  Delete all files except main cpp  file. You don`t need other auto created files. 


3. Write down the codes you need like this. 

4.  Drag and drop the dll file to Unity Assets/Plugins. It is recommended that you use release mode rather than debug mode while building the project. 
(Make sure you drag and drop to Plugins folder. Other folders  may not work or cause errors.) 
5.  Create a C# script and attach it to a game object. Write code as below.  
 Then you will have value of '1102' in integer variable "nRet". 

No comments:

Post a Comment