When I make games with Unity, sometimes I need to write a native plugin. C is the most used language for native plugins, but it's not safe. So recently I use Rust. (Though Rust's safety is limited because native plugins use foreign function calls, I believe Rust is safer than C.)
Then, I made small examples that use Rust from C#, including basic function calls, passing/receiving string, callback, passing/receiving struct, and handle Rust's object through a pointer.
You can build a DLL file by executing
Currently, the repo only has a .Net Core project, I'll add a Unity project.