Giter Site home page Giter Site logo

eriseven / unity_plugin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from profelis/unity_plugin

0.0 0.0 0.0 130 KB

Native plugin for Unity3D (sample)

License: MIT License

Shell 7.68% C++ 5.27% C 7.34% Objective-C 2.11% C# 20.51% Objective-C++ 6.99% Swift 4.24% CMake 42.57% Batchfile 3.28%

unity_plugin's Introduction

Native plugin for Unity3D (sample)

Native plugin for "all" unity targets with shared c++ code.

Main features

  • Supports macOS (+editor), Windows (+UWP) (+editor), iOS, Android, WebGL
  • Simple and clear build process
  • Shared c++ code
  • Shared Objective-C code for ios and mac targets
  • Shared Swift code for ios and mac targets
  • Debug/Release configuration
  • Raw source code sample for iOS/WebGL target (useful for debug)
  • Marshaling samples (strings, arrays, structs), manual marshaling

Compiling

I compile all targets on macOS and use Windows only for windows targets.

macOS

  • Setup environment variable ANDROID_NDK_HOME target to Android NDK
  • Open plugin folder
  • run buildall.sh, special params [-w add swift sample code] [-x generate xcode projects] [-r Release configuration] [-s copy sources for iOS target (useful for debug)] [-l webgl build]

Swift

  • Define SWIFT in Unity Player Settings window - Scripting Define Symbols setting
  • Swift target copy additional files in project, feel free to edit or remove them. Dummy.swift can be removed if you have another *.swift files. SwiftPostProcessor.cs configures Xcode project.

MacOS(+editor) dylibs are huge because contains all swift dylibs (see ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES)

WebGL static library (WIP)

Can't get working *.bc library right now (WIP)

opt: error loading file '<projectpath>/Assets/Plugins/unity_plugin/webgl/libunity_plugin.bc'ERROR:root:Failed to run llvm optimizations: 
   UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
  • Install Emscripten
  • Activate Emscripten source ./emsdk_env.sh

WebGL sources

buildall.sh -l -s works perfect, some include directives fail sometimes, simple place all *.cpp and *.h files in root Plugins folder

Windows

  • Install CMake 3.6+, MSVS, UWP SDK (optional)
  • Open plugin folder
  • run buildall.bat, special params [-r Release configuration]

make or MSVS or Xcode

See plugin/buildall.[sh|bat] for more information.

More info

iOS & MacOS

Android

WebGL

Marshaling

Todo

  • [android] test x86 library
  • [webgl] static library

unity_plugin's People

Contributors

profelis 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.