Unity Native Plugin Builder
Unity Native Plugin Builder is an Editor extension to automate the creation and the cross platform compilation of native Unity plugins.
Based on the CMake build system, you can create native c++ plugins, manage multiple build options and configurations, compile code, and copy binaries to the correct plugin folder in the Unity project, all with a press of a button.
Make sure to install CMake, if not installed already.
Multiple plugins with multiple builds are supported.
These platforms are supported (when available):
- Standalone (Windows, OS X, Linux)
- Universal Windows Platform
We are looking into supporting more platforms (Console, etc)
- Add the content of the repo to your project in
Assets/NativePluginBuilderfolder (or add as git submodule)
- Go to
Window -> Native Plugin Builder
- Go to the settings tab, and make sure that there is a CMake verion in the editor.
- Go to the plugins tab, and create a new plugin
- A new folder is now created. Add the
MyPluginExample.csscript to a
- Build the plugin for the Editor (The default build options should work for the editor)
- Hit play!
Using the editor you can create and define multiple plugins each with multiple build options.
- The name of the plugin will be used as the name of the library and the name of the C# class. Make sure it's a valid indentifier. It can only be set in creation time.
- The version and the build number are accessible to your c++ code through
- Make sure the paths are valid (They should be, by default):
- Source Folder should point to your c++ files location
- Build Folder is where the build scripts will be created. If you are using version control, this folder should usually be ignored.
- Plugin Folder is where the binaries will be after compilation
- You can add the
PluginAPIfolder in the include search paths, so you can use headers such as
IUnityInterface.h. Simply check the
Include Plugin APIoption.
- You can also add your custom defines, that will be accessible from c++.
- You can add multiple build options for different platforms and architectures
Buildbutton will compile your plugin for all the active build options
Cleanbutton will "TRY" to delete all folders and files from the Build folder
Removebutton will delete the asset file for the plugin settings. The source code will not be deleted.
- Each running process responsible for a build task, will show up in the status bar at the bottom, which you can cancel with the
- If you have more than one plugin, a
Clean Alloption will be available.
PRs and issues are always welcome. This project is in early stages, and does not implement complex features, such as the ones supported by CMake. But it will grow more and more, as developers meet specific needs for their c++ projects. If you see a missing feature or an error, please do report it.