Giter Club home page Giter Club logo

unityrustplugin's Introduction

UnityRustPlugin

Mandelbrot

This Unity sample project shows how to write a native plugin in the Rust language.

The sample plugin constructs the Mandelbrot set in a big array (1024x1024x4 byte) shared from a C# script. Then the C# script converts it into a 2D texture to draw on the screen. See the plugin code and the caller script for further details.

This project was inspired by Jim Flemming's article. It's recommended to check the article if interested in the topic.

How to build the plugin

The source code for the plugin is contained in the Plugin directory.

macOS/Linux

You can simply run build.sh to build the plugin.

Windows

There are some different approaches for Windows. I prefer using WSL2 and the cross-compilation target.

For cross-compilation from WSL2 to Windows, you have to install MinGW-w64 and the x86_64-pc-windows-gnu target.

sudo apt install gcc-mingw-w64-x86-64
rustup target add x86_64-pc-windows-gnu

Now you can run build.sh.

iOS

Install the aarch64-apple-ios target.

rustup target add aarch64-apple-ios

Run build.sh with passing ios to build the plugin.

./build.sh ios

Android

You have to install NDK and set the ANDROID_NDK environment variable to specify the installation directory.

Then, install the aarch64-linux-android target.

rustup target add aarch64-linux-android

Run build.sh with passing android to build the plugin.

./build.sh android

unityrustplugin's People

Contributors

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