This project goal is to build a Unity native plugin to call simple c++ code,then it works on multiplatform.
c++ code is simple.
//NativePlugin.cpp
#include "NativePlugin.h"
NATIVE_API void jp_the6th_NativeSample_func1()
{
return;
}
NATIVE_API int jp_the6th_NativeSample_func2(int i )
{
return i;
}
Platform | Status |
---|---|
Unity Editor(Windows) | ✅ Success |
Windows Standalone | ✅ Success |
HoloLens 1(UWP/x86) | ✅ Success |
HoloLens 2(UWP/ARM64) | Not yet |
Android (ARM64) | ✅ Success |
Android (ARM) | ✅ Success, but not tested |
Android (x86) | ✅ Success, but not tested |
LuminOS(Magic Leap/ARM64) | ✅ Success |
Mac OS | Not yet |
iOS | Not yet |
- Windows 10
- Unity 2019.1.0f1
- Visual Studio 2017
- Open NativePlugin/NativePlugin.sln
- Toolbar -> Build -> Batch build ,then press [Build]
- 7 of Dynamic libraries are generated to Unity project folder (UnitySample\Assets\Plugins).
- Open Unity project , /UnitySample , with Unity 2019.1.0f1.
- Setup Import plugin settings for each platform.
- Switch platform on build settings window.
- then,build and deploy it.