­­­Getting started with WebGL development

WebGL开发入门

What is Unity WebGL?

什么是Unity WebGL

The WebGL build option allows Unity to publish content as JavaScript programs which use HTML5 technologies and the WebGL rendering 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.

可以使用Unity的WebGL构建选项将内容以JavaScript程序发布,这当中使用了HTML5技术和WebGL渲染接口API以在浏览器中运行Unity内容。在Build Player窗口中选择WebGL构建目标,然后点击Build & Run,就能以WebGL形式构建并测试你的内容。

Technical overview

技术概览

To run in WebGL, all code needs to be JavaScript. We use the emscripten compiler toolchain to cross-compile the Unity runtime code (written in C and C++) into asm.js JavaScript. asm.js is a very optimizable subset of JavaScript which allows JavaScript engines to AOT-compile asm.js code into very efficient native code.

要在WebGL中运行,所有代码必须是JavaScript。我们使用emscripten编译工具链将Unity运行时代码(用C和C++编写)跨平台编译成asm.js JavaScript。asm.js是JavaScript的一个很可优化的子集,允许JavaScipt引擎将asm.js代码AOT编译成非常高效的原生代码。

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 convert your scripts to JavaScript.

为将.NET游戏代码(你的C#和UnityScript脚本)转换成JavaScript,我们使用了称为IL2CPP的技术。IL2CPP提取.NET字节码并将其转换成相对应的C++源文件,接着使用emscripten技术编译这些文件,将你的脚本转换成JavaScript。

Platform support

平台支持

Unity WebGL content is supported in the current versions of most major browsers on the desktop, however there are differences in the level of support offered by the different browsers. Mobile devices are not supported by Unity WebGL

大多数主流浏览器的当前版本都支持Unity WebGL内容,然而不同浏览器的支持程度不一样。Unity WebGL不支持移动设备。

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

WebGL构建里并不包含Unity的所有内容,这主要因为平台的限制。具体来说是以下几点:

·        Threads are 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 System.Threading namespace is not supported.

·        构建的WebGL内容不支持多线程,这是由于JavaScript本身就缺乏多线程的支持。其中包括Unity内部为提高性能所用的多线程,以及脚本代码和托管dll里使用的多线程。基本上,System.Threading命名空间里的所有内容都不被支持。

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

在MonoDevelop或Visual Studio中WebGL构建不能被调试。详见:WebGL构建调试及疑难解答

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

出于安全起见,浏览器不允许在网络编程里直接访问IP套接字。详见:WebGL网络编程

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

WebGL图形接口API相当于OpenGL ES2.0,其有很多限制。详见:WebGL图形技术

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

基于Web Audio接口API ,WebGL构建为音频使用自定义的后台技术,其只支持基本的音频特性。详见:在WebGL中使用音频

·        WebGL is an AOT platform, so it does not allow dynamic generation of code using System.Reflection.Emit. This is the same on all other IL2CPP platforms, iOS, and most consoles.

WebGL是一个AOT平台,因此它不支持使用System.Reflection.Emit动态创建代码。在所有其他IL2CPP平台、iOS和大多数控制台上也是不支持的。

WebGL开发入门的更多相关文章

  1. openresty 前端开发入门五之Mysql篇

    openresty 前端开发入门五之Mysql篇 这章主要演示怎么通过lua连接mysql,并根据用户输入的name从mysql获取数据,并返回给用户 操作mysql主要用到了lua-resty-my ...

  2. java WEB开发入门

    WEB开发入门 1 进入web JAVASE:标准- standard   JAVA桌面程序 GUI    SOCKET JAVAEE:企业-浏览器控制  web 2 软件结构 C/S :client ...

  3. [译]:Xamarin.Android开发入门——Hello,Android Multiscreen深入理解

    原文链接:Hello, Android Multiscreen_DeepDive. 译文链接:Xamarin.Android开发入门--Hello,Android Multiscreen深入理解. 本 ...

  4. [译]:Xamarin.Android开发入门——Hello,Android深入理解

    返回索引目录 原文链接:Hello, Android_DeepDive. 译文链接:Xamarin.Android开发入门--Hello,Android深入理解 本部分介绍利用Xamarin开发And ...

  5. [译]:Xamarin.Android开发入门——Hello,Android快速上手

    返回索引目录 原文链接:Hello, Android_Quickstart. 译文链接:Xamarin.Android开发入门--Hello,Android快速上手 本部分介绍利用Xamarin开发A ...

  6. VR原理讲解及开发入门

    本文是作者obuil根据多年心得专门为想要入门的VR开发者所写,由52VR网站提供支持.   1. VR沉浸感和交互作用产生的原理:   在之前,我们观看一个虚拟的创造内容是通过平面显示器的,52VR ...

  7. Eclipse_luna_J2EE_For_JS+tomcat8.0环境搭建、配置、开发入门

    一.所有需要的软件.插件等下载地址 J2SE的官方下载路径:http://www.oracle.com/technetwork/java/javase/downloads/index.html Ecl ...

  8. OWIN的理解和实践(三) –Middleware开发入门

    上篇我们谈了Host和Server的建立,但Host和Server无法产出任何有实际意义的内容,真正的内容来自于加载于Server的Middleware,本篇我们就着重介绍下Middleware的开发 ...

  9. [Cordova] Plugin开发入门

    [Cordova] Plugin开发入门 Overview Cordova的设计概念,是在APP上透过Web控件来呈现Web页面,让Web开发人员可以操作熟悉的语言.工具来开发APP.使用Web页面来 ...

随机推荐

  1. Angularjs Material

    公司用Angularjs Material进行开发,之前在网站上看了一些Demo,做一个学习的整理. 1.新建窗体的数据绑定 1.1修改kendo表格新增页面按钮,添加按钮,并Dialog一个窗体 t ...

  2. Linux 显示文本指定行内容

    主要采用sed.head和tail命令 如果文本中使用了 \n 这类符号,cat命令会把它当成换行符,结果会出错 $ sed -n "10p" move.sh   # 显示第10行 ...

  3. 关于华为P9手机的解锁、刷Recovery、获取Root、安装Busybox,以及升级降级的全过程(和一些错误的解决方法)

    我有一部华为P9手机,型号EVA-TL00,属于移动定制机.用了半年多了,想给手机添加一些功能,发现有些功能必须Root之后才能用代码实现,所以动了Root的打算. 一.手机解锁.(不解锁则无法对手机 ...

  4. 函数响应式编程及ReactiveObjC学习笔记 (二)

    之前我们初步认识了RAC的设计思路跟实现方式, 现在我们再来看看如果使用它以及它能帮我们做什么 One of the major advantages of RAC is that it provid ...

  5. Unity编辑器重写Inspector面板,面板中编辑的数据不触发场景发生变化的问题。

    今天开始协助主程一起制作新框架.主程让我写关于新版UI框架注册UI预制体用的快捷编辑器. 现学现写,总算完成了. 可以直接把选中的预制体添加到UIController的数组中,期间涉及到改变大小.所以 ...

  6. (转)Spring定时任务的几种实现

    Spring定时任务的几种实现 博客分类: spring框架 quartzspringspring-task定时任务注解  Spring定时任务的几种实现 近日项目开发中需要执行一些定时任务,比如需要 ...

  7. 一.CPU,Mem过高怎么办 --这是个开始

    本身是名Java开发,在做了一段大数据的工作后,猛然间想对Java做个总结. 从未写过技术博客,一时不知如何开始,思虑后,暂且以自己喜爱的方式来开篇. 工作中遇到过CPU或内存过高的问题,解决步骤: ...

  8. iOS字典转模型MJExtension使用

    如果项目是纯OC的建议使用,MJExtension是一套字典和模型之间互相转换的超轻量级框架,可以轻松完成: 字典(JSON) --> 模型(Model) 模型(Model) --> 字典 ...

  9. 性能测试——jmeter环境搭建,录制脚本,jmeter参数化CSV

    一.Jmeter+jdk环境搭建 1.http://www.oracle.com/technetwork/java/javase/downloads/index.html,下载jdk. 直接安装就行了 ...

  10. mk-js,一个基于react、nodejs的全栈框架

    前言 在这个前端技术爆炸的时代,不自己写套开源框架出门都不好意思跟别人说自己搞前端.去年年初接触的react,16年7月份在github开源了一套针对react.redux探索的项目,近期和伙伴们一起 ...