Skip to content

An interface between rust and unity. Use rust in unity, for modding or scripting.

License

Notifications You must be signed in to change notification settings

dimitri-br/runity

Repository files navigation

Runity

Runity explained

What is it?

runity is a rust to unity interface library. Currently, it doesn't reimplement every unity function and quirk, but it is a goal. It aims to act as an alterative scripting language than c# in unity, and can be used for everything from modding to regular scripting.

How does it work?

runity works by implementing unity datatypes, functions and more into an interface callable by rust. The script written in rust is then compiled into a dynamic library, which is loaded into a unity application at runtime. This allows for rust to be used for modding and scripting support, or to be used as the whole backbone of your game.

How do I use it?

Please look at the examples to see a simple example of usage.

Your library must be a ["cdylib"] type. Please look at the example toml file for a base to start off.

image

You should build it, then copy the resulting library (on windows this is a *.dll) from the build folder to a Assets/Plugins folder in unity. The included scripts (found in cs_examples) will automatically find the dlls in the folder.

image

To use the library in unity, take both scripts from cs_examples and make sure your library is in Assets/Plugins. Then, attach DLLPool.cs to an empty gameobject. This will store the loaded libraries throughout its lifetime.

image

Then, create any gameobject and attach runity.cs to it. It takes in one parameter - the name of the library. If your library was called runity.dll, you would input runity.dll. Now click play, and your gameobject will be running through rust!

image

Runity does not aim to implement all Unity types. It will provide a base to expand upon. It will, however, provide enough to modify transforms as well as provide functions such as getting gameobjects. The examples provided should give a good idea on how to use and expand runity to fit your needs.

About

An interface between rust and unity. Use rust in unity, for modding or scripting.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages