2 ms·
Awesome! That means we can hopefully soon play Unity web games on linux too! Last time I checked they only had plugins for windows. > To convert the .NET game
by lawl 13y ago
Awesome! That means we can hopefully soon play Unity web games on linux too! Last time I checked they only had plugins for windows.
> To convert the .NET game code (your C# and UnityScript scripts) into JavaScript, we developed a new technology in-house which we call IL2CPP. IL2CPP takes .NET bytecode and converts it to corresponding C++ source files, which we can then compile using any C++ compiler — such as emscripten to get your scripts converted to JavaScript. Expect more information on IL2CPP soon.
This however ... It's cool that it works.
But do we really have to compile C# to IL bytecode to CPP source to LLVM IR to asm.js javascript which the browser will compile to native code.
Just... I'm kinda speechless, not that this is possible, but viable for release.
Well the demos show it is. Still.
- azakai 13y ago> But do we really have to compile C# to IL bytecode to CPP source to LLVM IR to asm.js javascript which the browser will compile to native code. I guess you're saying that it sounds like a convoluted process? There are other ways to run C# on the web, like JSIL which compiles C# more directly to JS. In practice each approach has benefits and disadvantages. But I wouldn't say that C# to IL to C++ to LLVM to asm.js to native is convoluted. It reuses a lot of existing tools (LLVM, Emscripten), and makes a lot of sense: Once you have C# to C++, you can compile that on any C++ compiler, including platforms where you couldn't run the Mono VM. C++ is as portable as it gets.
- flohofwoe 13y agoActually, it would be interesting what the performance looks like when the intermediate C++ code is fed into compiler toolchains which produce native code, and how this compares to the Mono JIT performance. Also, whether this approach will benefit other Unity target platforms like iOS or Android.
- bilbo0s 13y agoI was wondering about that too. Why not just let us write to the C++ API ??? It seems .... circuitous. And I don't like the debugging implications at all.
- drawkbox 13y agoThere was a time when Unity was going to go with a C++ api during that Apple ToS 3.3.1 clause that banned lots of platforms like Flash in 2010: http://blogs.unity3d.com/2010/07/02/unity-and-ios-4-0-update-iii/ http://blogs.unity3d.com/2010/07/02/unity-and-ios-4-0-update... The fear was Apple would ban mono AOT as well. During that time they were going to go C++. I wonder what would have happened. Now that UE4 is pure C++ it does have that. C# is great and you can accomplish most things with plugins via C/C++/Obj-C/Java but having the pure C++ option would be killer. Then it would be a much easier jump into final form for WebGL/asm.js/etc. Unity also has the Mono 2.x runtime and hasn't updated Xamarin licenses to go to mono 4. I wonder if they would be smart to jump to a C++ api at some point that could still use C# scripting possibly but goes to this lower level C++ form. It is hard with such a large userbase to jump to C++ but in 2010 they almost did.
- MayorOfMonkeys 13y agoYeah, I'm curious to find out how script debugging will work with WebGL exports. Tough problem to solve. One of the nice things about PlayCanvas* (https://playcanvas.com/ https://playcanvas.com/) is that you can debug your GameObject scripts using the integrated dev tools in any browser (or even do remote debugging on mobile targets). * Disclaimer - I work on this! :)
- azakai 13y agoI would guess people would debug their games in the Unity editor, like always. In theory you can use the browser dev tools, and emscripten can emit source maps which helps. But the Unity editor is probably a far better experience for this use case.
- MayorOfMonkeys 13y agoI guess so. But the blog entry does call it out as a feature that won't be delivered initially, which suggested to me it's seen as 'important'. Also, let's take profiling. I wonder how easy it will be to pinpoint performance bottlenecks in Unity script code using the browser's dev tools.
- CmonDev 13y agoWelcome to the "open" web.