1 . Create an empty C# class library
![](https://img.haomeiwen.com/i5269115/e9e63bab9fbd99e2.png)
![](https://img.haomeiwen.com/i5269115/10f4309ff3b259c2.png)
2. Compile you class
![](https://img.haomeiwen.com/i5269115/1f05b2edb7de9b62.png)
Change you target .Net Framework (int unity 5.5.1, it need to be .NET3.5 or lower
![](https://img.haomeiwen.com/i5269115/1a2a504af3bb52e8.png)
![](https://img.haomeiwen.com/i5269115/4057d0aee614dbc7.png)
then build your project
![](https://img.haomeiwen.com/i5269115/6bd57ebb4fc06f64.png)
![](https://img.haomeiwen.com/i5269115/5bc2264801284b2f.png)
get back to you project in files, you will get you own dll under path bin/Debug
![](https://img.haomeiwen.com/i5269115/af82c8f9fc4dc3e0.png)
drop to you unity project
![](https://img.haomeiwen.com/i5269115/319681bacdbcced0.png)
![](https://img.haomeiwen.com/i5269115/54c4c9165247089b.png)
Use dll in unity
![](https://img.haomeiwen.com/i5269115/096a2f08ab1cb30c.png)
Add references of UnityEngine.dlland/orUnityEditor.dllto the project, you can do so by browsing into the folder (typically, depending on your specific Unity3D installation directory):
Mac: /Applications/Unity/Unity.app/Contents/Frameworks/Managed/
Windows: C:\Program Files\Unity\Editor\Data\Managed
![](https://img.haomeiwen.com/i5269115/d03e6c7e7a6acca4.png)
![](https://img.haomeiwen.com/i5269115/b726c50971c50943.png)
网友评论