一般C/C++的代码通过VisualStudio生成.Dll文件,然后在unity中通过C#的代码调用即可。
一,创建C++的项目
选择动态链接库。输入项目名称以及保存路径之后,点击确定。
这样我们的C/C++项目就创建成功了
二,在源文件中创建c/c++代码
然后我们需要在我们创建的DllForUnity.cpp中添加代码:
#include "stdafx.h"
#include "DLLForUnity.h"
#include <stdio.h>
#include <iostream>
using namespace std;
DLLForUnity_API int _stdcall Delete(int a, int b)
{
return a /