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.
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.
Please look at the 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.
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 ) will automatically find the dlls in the folder.
To use the library in unity, take both scripts from 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.
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!
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.