How do you use javascript scripts in Unity C#?!

Hi :slight_smile:

theres this realy cool WebApp called MongoDb Stitch.
You can write server functions, do authentification and what not.

To connect with it from code it has support for javascript. Since Unity will drop javascript support.
is there a way to propagate the methods from the javascript script to C# ?

This is server side thing. You may create HTTP API using node.js as popular server scripting solution and connect to it via UnityWebRequest API from you unity game. There’s no need to directly interact with it from unity scripts be it c# or js.

It’s worth knowing that the “Javascript” that Unity supported was never really Javascript and never would have been even remotely compatible with this code regardless.

It would most likely have to be reimplemented in C# completely. You might google around to see if someone has already done that. One of the first results I can find (bearing in mind that I haven’t really made any effort to understand the use case or the specific code) is this link, which may work. (This is written for Unity from 5-ish years ago and thus might need a bit of updating to bring it up to speed with the modern Unity API, but that shouldn’t be too difficult.)

edit: palex-nx’s response above is better advice on moving forward probably

1 Like