- Home /
Embedding scripting language (webgl-compatible)
Is there currently any scripting language that can be embedded into Unity, and still work when the project is exported to WebGL?
So far I have tried quite a few, but no luck. Many require the ability to dynamically generate IL code (which isn't available in WebGL).
The most "promising" one I tried was probably MoonSharp, but no luck either. There seems to be no hard technical limitation, but, scripts always fail to run due to some unknown problems.
(Other languages such as IronPython I haven't tried because I believe that they just can't work due to the IL generation issue).
Answer by mgear · Feb 26, 2017 at 10:11 AM
Latest Moonsharp works with webgl (older versions apparently had problems)
Have tested it with Moonsharp 2.0 and Unity 5.5.1p3 webgl (tested the factorial sample and FungusLuaUtils)
Answer by gfoot · Oct 02, 2015 at 10:25 AM
The simplest option for WebGL is to use Javascript itself, executing within the browser. You can load and run scripts dynamically by asking the browser to evaluate them, and with an appropriate jslib you can call arbitrary Javascript functions and - with care - the Javascript can also call your compiled C# methods (e.g. so you can provide entry points for the scripts to interact with your game engine).
I am interested in developing a plugin for this, so if you want to talk about your needs privately then please feel free to message me!
However this would only work in WebGL builds where we can lean on the browser to execute the scirpts. For the editor and other platforms it would require a dedicate Javascript interpreter - I think there are some already on the asset store but compatibility might need some care.
Answer by Schubkraft · Jul 27, 2015 at 10:18 AM
WebGL supports only supports AOT and no threading.
Have you looked at https://www.assetstore.unity3d.com/en/#!/content/645 or something similar? No idea if that works with WebGL but still might be a good start for you.
I don't think it can work :( That plugin seems to be based in IronPython, which I'm pretty sure generates code dynamically.
Your answer
Follow this Question
Related Questions
Embedded standalone application in Qt window: communication and automatic resize 1 Answer
Is it possible to embed a YouTube video in Unity's WebGL build? 1 Answer
Embed Unity Webgl game to wix website 1 Answer
Loading Scripts from asset bundle in iOS and WebGL. 0 Answers
How to embed WebGL game on a website? 4 Answers