GithubHelp home page GithubHelp logo

wm4n / unity-cpp-lib Goto Github PK

View Code? Open in Web Editor NEW
41.0 7.0 12.0 61 KB

A simple demonstration of using c++ library for Unity plugins

License: MIT License

C++ 51.50% C# 48.50%
unity unity3d unity-3d cplusplus dynamic-link-library unity3d-plugin

unity-cpp-lib's Introduction

Building C++ DLL for Unity Plugin

A simple demonstration of using C++ library (DLL) in Unity. This repo describes how to build a C++ library in the form of dynamic linked library (DLL), encapsulate C++ classes and export functions. On the other hand, this repo also shows how to import and use the library (DLL) in Unity via c# script.

How to Use Repo

This repo contains two folders:

  1. SampleCppDll - A Visual Studio Community 2017 project and C++ files.

  2. UnitySampleDll - An Unity project that make uses of the DLL built by SampleCppDll. Unity version 5.6.2f1 is used here.

Quick Start

  1. Use Visual Studio Community 2017 to open the SampleCppDll solution file SampleCppDll/SampleCppDll.sln

  2. Use the menu Build > Build Solution to build (Remember to set the architecture x64 and it's assumed 64bits environment here)

  3. Copy the output file SampleCppDll.dll under SampleCppDll/x64/Debug/ to UnitySampleDll/Assets/Plugins/ (If release build is used then it's under SampleCppDll/x64/Release/)

  4. Use Unity 5.6+ to open folder UnitySampleDll

  5. Open UnitySampleDll/Assets/Scene/Main.unity

  6. Run it in the editor. Output from DLL will be printed in the Unity console tab.

  7. More functions can be added to the C++ projects or even linking other library (Note that all linked dynamic linking library has to be copied to the UnitySampleDll/Assets/Plugins folder). Enjoy the boilerplate ~

unity-cpp-lib's People

Contributors

wm4n avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.