Using GDNative & C# in WebAssembly builds

Godot Version



While waiting for Godot 4 to add HTML exports for C#, I’ve started working with Godot 3.5.3. To learn it I’ve made a small game, and so far everything is going well. There are several places in my game where the code takes rather long to execute, and since I’m also learning Rust, I thought about using it to maybe take advantage of its speed. So for the past few days I’ve been trying to combine it all into one working package.

Making Rust code work in desktop Windows builds was relatively easy, but with the HTML export it feels like every time I get over one obstacle I get derailed by another. Yesterday after several hours I’ve managed to make the .wasm modules work in both desktop and HTML, but it turned out the export templates I’ve built didn’t have Mono enabled and can’t load C# scripts. So I went back, built the Mono glue and tried building the templates again, which leads me to my current problem.

I can’t build the platform=javascript templates, as apparently SCons can’t find Mono library files:

Found Mono root directory: C:\Program Files\Mono
RuntimeError: Could not find mono library in: C:\Program Files\Mono\lib:

From what I’ve found online, I should obtain Mono WebAssembly SDK from Mono Project Jenkins, but that got shut down a few years ago and as far as I can see there are no existing mirrors of those SDKs. I’ve looked into maybe building them from source, but again I only found working solution targeting x64 windows, but nothing for wasm.

So my question here is - is there actually any way to achieve what I’m after? Maybe a source for pre-built webassembly_gdnative templates with Mono that I’ve missed? Some other source of the SDKs? Or a way to build the templates without it? Or something completely different that I didn’t even find? Or is it simply no longer possible and I should just stick to using pure C# if I intend to target HTML exports?