How to make NATIVE PLUGINS in Unity using RUST
HTML-код
- Опубликовано: 21 янв 2025
- In this video, I teach you how to develop your own NATIVE PLUGINS for the Unity Engine by using the power of the Rust Programming Language.
Sometimes when doing game development there are critical paths that need to be sped up by native code. Writing that code in any C language is hard and boring. RUST has the tools to make native libraries that we can leverage in the Unity Engine to make some really powerful and blazingly fast code.
Rust Native Package: github.com/rhe...
Blog / Text Version: blog.hedgecock...
Interoptopus: docs.rs/intero...
#UnityEngine #RustProgramming #GameDevelopment #NativePlugins #UnityDevelopment #RustLang #CodeOptimization #BlazinglyFast #GameProgramming #NativeCode #ProgrammingTutorial #GameDevTips #UnityTips #RustLibrary #GamePerformance
Your editing is amazing, 3.50 got me so pumped up!
Thanks! It was fun to record for sure.
The jazz at 0:20 cracks me up. Love your video style, keep it up. And heck, may need to try Rust out now.
ONE OF US! ONE OF US! ONE OF US!
In all seriousness, I appreciate your comment! Thanks for watching!
Your video style is amazing ! ✨
Apparently I'm your 1000th subscriber, congrats on the milestone of 1k subs! Great videos
Holy smokes that was fast! Thank you so much for your support! I better step up my game and get my next video out soon so you all have some new content 😅
You will definitely blow up, love your video
Love your style! I would like to see some examples of real usage for rust code in Unity, as you can't access Unity components or call something outside Rust, right? So, what's your usage for this? Doing calculations, physics, parsing data or things like that?
So, if it's possible, in a future video do a really small game, with a few assets and simulating a real development. Idk, a simply platformer. That way we can see the amount of work on unity that's needed to work along side Rust.
I also love to integrate Rust in all my projects ^^, I'm even doing native plugins that I'm using in NodeJS for a webserver at my work.
Anyways, great video! I hope to see more of you in the future :)
Thanks for the kind words and the suggestion! That's a good idea, will certainly consider doing a video like that soon!
You're right that you would not be able to access unity components from rust. At least not easily that is. My use case is for really heavy calculations in critical paths. I'll try to make an example soon!
Very underrated and entertaining video! As both a seasoned Unity & Rust dev seperately, I am very curious what kinds of things you use/would use this for? Does this allow you to make use of any crates on the rust end?
Great question! Yeah once you cross the FFI boundary, you can take full advantage of all rust has to offer! Easy multi threading using rayon and whatever other library you want to use. It's fantastic! Thanks for the comment 😁
@@rhedgeco 👀 full advantage of rust you say? This sounds like a dangerous tangent to get lost in and I'm all for it. Thanks for showing it off! Keen to see what you put out next
Your video was very entertaining, you really did a great job in the middle. 😁
Thanks! It was a lot of fun to make
Good jobs my friend. New start on your github project.
i love the video style !
this can help me creating arduino simulator ?
where user write C code and get translated to c# ?
It would take some work, but it's certainly possible.
@@rhedgeco do u suggest a logic i can follow to make such system ?
@@siamandshahadmira-1041 There are a few rust libraries for compiling C code at runtime. If I understand correctly you should take a look into those and see if they work for you.
unsure what are the benfits, I usually create DLLs with Rider and C#
You are insane!
is it possible to do with zig
I have never used zig at length but as far as I understand, zig can make libraries that are c-style so you can make libraries that are compatible the same way that rust is.
how does this compare to building using il2cpp instead of mono? Would you notice any major performance gain? What about when compared to burst compiled functions? Awesome video!
Thanks for the comment! It really depends on the use case and how you are doing it. There is a slight overhead to using FFI functions so the more processing that can be done on either side before crossing the language barrier the better. That said I've done previous videos using the burst compiler and they are fairly comparable. I personally like rust because of the easier multithreading which usually speeds things up. Both I've found are faster than using il2cpp for what its worth, but again it has its use cases.
@@rhedgeco Awesome thanks for the info!
This is freaking cool! I have already tried your solution and it works like a charm!
But I wonder if it is possible to call Unity and SDK APIs in rust? It looks like it is quite difficult to achieve from what I have researched so far.
yes, Officer, a bag of orange powder. No, Officer, it's not mine - a deranged internet man forced it into my hand and told me to thank him later, before disappearing into the hedgerow
I am on a Mac. How do I do this without C#?
This is a unity engine tutorial. Unity engine and C# work on Mac computers. There should be no problems related to operating systems
I need help with java native plugin ;((
hey hows the procedural music going?
Thanks for the comment! My next video will be diving back into that since people seemed to love it so much
is it working cross platform?
This should absolutely work cross platform. I have not tested on Mac however so there should be some changes to the code to get it working there
? What's the purpose of this?
This is hilarious lmao
Glad you liked it 😁
@@rhedgeco What are your plans with boba? :)
@@pepinzachary It's been a huge testing ground for me. Ultimately my goal is to make games in my own engine, instead of relying on unity.