Getting Started with WebGL development

Source: Internet
Author: User
Tags emit emscripten

Getting started with WebGL development

WebGL Getting started with development

What is Unity WebGL?

What is Unity WebGL ?

The WEBGL build option allows Unity to publish content as JavaScript programs which use HTML5 technologies and the WebGL R Endering API to run Unity content in a Web browser. To build and test your content for WebGL, choose the WebGL build target in the build Player window, and click build & Run.

You can use Unity's WEBGL build options to publish content as a JavaScript program, which uses the HTML5 technology and the WebGL rendering interface APIs to run unity content in a browser. You can build and test your content in WebGL form by selecting the WebGL build target in the Build Player window and clicking Build & Run .

Technical Overview

Technology Overview

To run with WebGL, all code needs to is JavaScript. We Use the Emscripten compiler toolchain to cross-compile the Unity runtime code (written in C and C + +) into Asm.js JAVASC Ript. Asm.js is a very optimizable subset of JavaScript which allows JavaScript engines to aot-compile asm.js code into very eff Icient native code.

To run in WebGL, all code must be JavaScript. We use the Emscripten compilation toolchain to compile the Unity Runtime code ( written in C and C + +) across platforms into Asm.js JavaScript. Asm.js is a well-tuned subset of JavaScript that allows the Javascipt engine to compile Asm.js code AOT into very efficient native code.

To convert the. NET Game Code (your C # and Unityscript scripts) into JavaScript, we use a technology called IL2CPP. Il2cpp takes. NET bytecode and converts it to corresponding C + + source files, which is then compiled using Emscripten to C Onvert your scripts to JavaScript.

For Will . NET game code (your C # and Unityscript scripts) into JavaScript, we used a technique called il2cpp. Il2cpp extract . NET bytecode and convert it to a corresponding C + + source file, then compile the files using Emscripten technology and convert your script to JavaScript.

Platform Support

Platform Support

Unity WebGL content is supported in the current versions of more major browsers on the desktop, however there is diff Erences in the "offered" by the different browsers. Mobile devices is not supported by Unity WebGL

The current version of most major browsers supports Unity WebGL content, but different browsers support the same level. Unity WebGL does not support mobile devices.

Not all features of Unity is available in WebGL builds, mostly due to constraints of the platform. Specifically:

The WebGL build does not contain all of unity's content, primarily because of the limitations of the platform. Specifically, the following points are:

· Threads is not supported due to the lack of threading supporting in JavaScript. This applies to both Unity's internal use of threads to speed up performance, and to the use of threads in script code and Managed DLLs. Essentially, anything in the namespace are not System.Threading supported.

· The built WebGL content does not support multi-threading, because JavaScript itself lacks multithreading support. This includes multiple threads used within unity to improve performance, as well as scripting code and multithreading used in managed DLLs. Basically, System.Threading all the content in the namespace is not supported.

· WebGL builds cannot is debugged in MonoDevelop or Visual Studio. See: Debugging and Trouble shooting WebGL builds.

· WebGL builds in MonoDevelop or Visual Studio cannot be debugged. See:WebGL Build debugging and Troubleshooting .

· Browsers does not allow direct access to the IP sockets for networking, due to security concerns. See: WebGL Networking.

· For security reasons, the browser does not allow direct access to IP Sockets in network programming . See:WEBGL Network Programming .

· The WebGL graphics API is equivalent to OpenGL ES 2.0, which have some limitations. See: WebGL Graphics.

· the WebGL graphics interface API is equivalent to OpenGL ES2.0, which has many limitations. See:WebGL Graphics Technology .

· WebGL builds use a custom backend for Audio, based on the Web Audio API. This supports is only basic audio functionality. See: Using Audio in WebGL.

· Based on the Web audio interface API,WebGL is built for audio using a custom background technology that only supports basic audio features. See: using audio in WebGL .

· WebGL is a AOT platform, so it does isn't allow dynamic generation of code using System.Reflection.Emit . This is the same on all other il2cpp platforms, IOS, and most consoles.

· WebGL is an AOT platform, so it does not support the use of System.Reflection.Emit dynamic code creation. It is also not supported on all other il2cpp platforms,iOS, and most consoles.

Getting Started with WebGL development

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.