Some tips for Unity5 in the WEBGL platform package

Source: Internet
Author: User

Recently in touch with the unity of the WebGL platform, in fact, this platform as a substitute for Web player, has been able to meet most of the development needs, and do not need additional plug-in support, it is indeed convenient, but still encountered a lot of problems in development, here to record and share the solution.

The first is the build option, in "Player Settings".

Resolution and presentation and old Web Player don't change, you can put your homemade templates into

"\unity\editor\data\playbackengines\webglsupport\buildtools\webgltemplates" directory inside, the specific usage after slowly pits.

Other settings, the other settings, and other platforms are somewhat different, it is worth noting that this "Strip engine code", stripping the engines of the options.

The official document describes it as "if selected, unity will default to the components that will not be used in the project", that is, if there is no audio feature in your project, unity will remove this part of the code to reduce the size when it is encapsulated.

At first blush feel, ouch, good oh! In fact, unity defaults to this option, but if your project uses the resource bundle "Assetbundles" to load dynamically, it's possible to fall into a pit.

Because the code is stripped, then on the Web page to run, F12 open debugging can see Manmianhongguang.

At this time there are 2 ways, one is in the project file directory, the construction of a link.xml file, the contents are as follows

"Unityengine.collider" is the class to refer to, referring to other unityengine.ui .... And so on

Click here to go to the official Link.xml's explanatory document

< linker >    <  fullname= "Unityengine">        <FullName  = "Unityengine.collider"  preserve= "All"/>    </  Assembly></linker>

Save the file to the assets folder in the Unity project

The second method is simply to remove the option of stripping code, build volume will increase, but if the above method does not solve the problem, this may be the last way.

Then came "Publishing settings", publish settings, in my current version unity5.4, leaving only three options

The first is the allocation of the size of the WebGL available memory, in megabytes, if it's too small to run for a while, a memory overflow error warning appears, too many settings are not appropriate, and the memory-strapped machine is estimated to be gameover.

Personal advice between "64-512", the default is 256, in fact, the simple project is enough to use, the value set here can also be modified in the index.html file after encapsulation, the location is located in the <script> tag at the bottom of the page

Unit is byte (b), because WEBGL builds slowly, if you want to adjust this parameter, you can directly modify the page, save a lot of ginseng.

<Scripttype= ' Text/javascript '>         varModule={total_memory:268435456,//This is the available memory size ErrorHandler:NULL,Compatibilitycheck:NULL, Dataurl:"/release/ .", Codeurl:"/release/ .", Memurl:"/release/ .",        }; </Script>

The second parameter, "Enable Exceptions", is a switch for exception capture, which can be opened during commissioning and removed when the final product is released.

A total of three options

None: Off

Explicitly thrown Exceptions only: The default option, which only handles the code of the throw part of the script, and also increases the volume of the code.

Full: As the name implies, all debug information is captured, and the official document says that in addition to the throw in the code, empty references, illegal indexed arrays, and stack information are captured together.

At this point, we have briefly introduced some of the details of the release settings, about WebGL, due to less domestic documents, I will continue to introduce, there are better ideas welcome message exchange.

Some tips for Unity5 in the WEBGL platform package

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.