Unity factory lecturer decryption

Source: Internet
Author: User
Tags web hosting

Http://blog.csdn.net/akof1314/article/details/38683209

This article Reprinted from: http://nedwu13.blogspot.tw/2013_11_01_archive.html

Asset bundle workflow and character discovery example-Zookeeper
  • There are two types of resources in Unity (Is there two types of resources ?) :
    • Resources: has a history of 10 years.
    • Asset Bundle: zookeeper AB. Now unity processes the data source center.
  • AB selection Deviation
  • The cache of the replicasset bundle in Web player needs to be collected. In iOS and Android, the cache does not need to be collected. ---> Use it with a hand-held robot !!!
  • The Cookbook itself also has a cache. Why should we use the unity cache?
    • The reason is that there is a solution in the cache, so you do not need to renew it again next time, because the CPU time in the big province is insufficient.
    • Unity manages the cache size, which will be deleted after the zookeeper case is resolved.
    • Browser can only store the asset bundle of zookeeper, and the location of each browser is different. --> Payment is poor
  • Assetbundle. createfrommemory
  • Assetbundle. createfromfile
  • Assetbundle. load is different from application. Load. application. Load can only load things in streamasset.
  • Each time a WWW is used for accessing assetbundle, 8 Mb buffer is used. Therefore, the following actions should be taken to clear the 8 m after the WWW is used:
    • Www. Dispose
    • Assetbundle. Unload (false)
    • Resources. unloadunusedassets
  • Assetbundle can be used as dependency !!!
    • Buildpipeline. pushassetdependencies to push the data source
    • Buildpipelinepopassetdependencies
  • False settings push the following resources: A, B, C, through Push & pop, three packages can be generated, C depends on B, A, B according to, the asset bundles established by a will not repeat the package resources at all!
  • In a prefab, mesh, material, shader, texture, and script should all be split into packages, and loaded back in the sort order during load, in combination with the cache mechanism, the asset bundle that has been written does not need to be downloaded again, optimal use of resources and databases --> however, the dependency between resources must be clearly specified. Otherwise
  • The official practice is that each asset bundle is about 1 MB. When it is too small, there will be too many requests, and the duration will be too long.
  • You can put the script in scriptobject, and then retrieve it through asset bundle, so you do not need to put the script in the first package.
  • In the official demo, the size of bytes MB can be reduced to 8.2 MB through dependency!
  • To learn how to handle role dolls, you can test the character customization examples provided by unity to see how to split asset bundle.
  • The geographic chart processing method allows you to split the geographic chart into multiple sub-scenes. When the main character moves, it is immediately displayed.
  • The asset bundle has a CRC mechanism. If there is a problem with the next Shard, it will automatically re-launch the shard.
  • Code Security
    • The iOS platform does not need to worry about the token (JB just said)
    • Other platforms can use asset bundle + to convert code into. Net Assembly + assetbundle. createfrommemory for encryption and decryption.
    • The Web is not used to package code into Native DLL.
Information Source dismantling and dynamic loading of big planning scene-xin
  • When the game goes into the game, the players do not even go into the game.
  • The Unity scene only supports 4096x4096, which is a single-digit meter. You cannot create a larger scene.
  • There are two types of Splitting:
    • Terrain resource splitting
    • Table sharding
  • Push shard splitting tool: terrain composer, limit 16km
  • What should I do if I already have a bunch of terrain? Split by yourself
  • How can terrain resources be split? Terrain of nxn
    • Terrain Data: place data in the corresponding shard --> big project
    • Light map: use free image to split the. EXR release case of light map. Free Image provides C ++ native DLL.
    • Level of detail (details): Repeat each iteration as terrain. setneighbors.
  • How to split the surface materials?
    • The root region terrain is separated and split
    • Use assetbundle depedency to package
    • A pack is about 1 MB
  • Split. How can I explain it?
    • Assetbundle is too large. Load
    • When the camera moves, it enters the nine cells centered on the camera, and the others are released, ensuring the memory usage and efficiency.
    • Avoid repeated instantiate and destroy, which may lead to machine pulling (?) The reclaim mechanism is too complex (10 milliseconds on average) and can be used as an object pool.
    • Avoid opening multiple WWW instances at the same time and consume the memory. www uses thread to increase the system complexity.
    • Coroutine should not be too many. It is officially recommended that multiple resources be created under a coroutine in sequence.
  • Inbound time ratio:
    • Shader, material: the longest import time, mainly in the parse content into the GPU, it is recommended that the first import, anyway, does not occupy the memory. This is also the relationship between 1 x FPS and 5 x FPS in the demo case. --> First mention
    • Texture, particle
    • Mecanim, audio
  • For the object pool example, refer to the sub-accounts in angrybot.
  • The scene after the scene demo is split is very refined, and the location exceeds 4096x4096, when a mobile phone crashes, the terrain is displayed after the assetbundle is triggered, the FPS is above 50, and the architecture is also optimized on mainstream mobile phones.
Use the unity engine to develop a 3D Web Hosting Solution.
  • Modify the loading unity upload logo, unityobject. embedunity, and set the parameter for 3.4.
  • Unityobject2 (Params), change Params for 4.x
  • To expose a new window, Openurl does not work, externaleval does not work, to use html iframe/Div, also available rokbox, http://www.rockettheme.com/extensions-joomla/rokbox
  • Unity uses wwwform for post and WWW for get --> directly accessing analyticdb is a bit blind.
  • Web Hosting internal Content Protection:
    • Code encryption: pack the code into asset bundle, save it as a textasset, and then package it into assetbundle (for Cache !), Reflection is used for access.
    • Code obfuscation: the Web Platform requires official help. Android can do it on its own, but IOS does not need to do it.
    • Data source encryption: texture is needed most. It can be encrypted and saved as a textasset. Remember to package it into assetbundle before you can use the cache.
  • Remember the leak. The profile of 4.1.2 shows the quota of all gameobjects. Use profiler more.
  • When dynamic loading is enabled, scriptableobject is used to define the Scene Description and record the dependency. Then, these resources are used to compile the scene content.
  • Coroutine is not a multi thread in unity. If it is used for multiple purposes, it will drag the main thread. Please use it with caution.
  • Load the material and shader out of a new scene or new access card and put them in an empty gameobject. Then diactive, it must be placed in the correct place. --> The second mention
  • The granularity of assetbundle packaging. The smaller the debug package, the better. The release proposal is 1 MB.
  • Block the right player function to prevent users from updating the unity Player version.
  • To retrieve the resources of other URLs from the Web server where the hosts file is stored, you must set crossdomain. xml.
  • If you do not need asset bundle, You need to manually parse the zookeeper. You must immediately resolve the issue at the next time, and use assetbundle. createfrommemory to consume time. --> The assetbundle does need to be loaded before resolving the issue...
  • Material and shader pack first! --> Should this be the third time? Why do I need to renew it three times because it is very important ??
Unity's Network Solution
  • Very good sleep zzzzzzz
  • Photon server: C # interface, which is implemented in C ++ at the bottom. It can load 30 K at the same time. It is based on the Load Balance Machine and has an FPS example. It uses TCP and rudp, only Windows is supported.
  • Smartfox server, http://www.smartfoxserver.com/, java‑enabled, windows/linux, and load balance are available, providing multiple render control and management interfaces.
  • Use raknet as your own
Improved performance of the Unity engine-xin min
  • Mobile regionalization
    • 300 ~ 2000 Polygon
    • Skinned Mesh Renderer can have at most one
    • Texture data volume: 1 ~ 3
    • Bone data volume <30
  • Static object
    • <500 poly
    • Mark static
    • Do not use Animation
  • Terrain: texture data volume <4, combined with texture, can be added to 5 FPS ~ 10fps
  • Texture format
    • PNG, TGA
    • Not more than 1024
    • It looks good. We can use 128x128 instead of 256x256.
    • Use mipmap
    • Control the UV limit in (0, 1) --> can it still exceed?
  • Mesh regionalization, with meshlab, but can only be simplified to zookeeper mesh. Use simplygon,
  • Mesh regionalization and animation regionalization. Use simplygon, http://www.simplygon.com/to improve efficiency.
  • Do not use system. XML with mono. xml. Reduce the program memory size.
  • Forwarding light principle, the number of objects in the draw X-ray source is required, so the less the light source, the better.
  • Set the pixel light value to a fixed value. There is only one parameter for the beauty of the image.
  • On the mobile platform, a particle uses a block as a single render. Too many particles increase the pixel filling rate. Because the particles do not have depth, they must be hidden, if the power of the mobile platform is not enough, the efficiency will be greatly reduced.
    • Smaller particles
    • Particle count <50
    • Particles do not have alpha
    • Do not collide with particles
  • Mesh colider is not used for failover, and box and capsulecollider are used.
  • Animation Section
    • No need for animation, no need for every thing
    • If scale curve is removed from manual or program operations, you can reduce the number of blending jobs by 33%.
    • Mecanim is a multi-disciplinary line that does not drag the main thread. Multiple animation clip on a game object is useful. If there is only one clip, you can test that only the animation is used.
    • Use the body mask to tell mecanim which region does not need to be calculated
  • Renderer
    • Avoid Alpha test and Alpha Blend
    • Static batching requires a large number of vertexbuffer. If there are too many vertex instances, we need to move a bunch of vertex instances to improve performance.
    • Dynamic batching is automatically triggered in polygon <900. If the shader of the gameobject has a position, normal, UV, and each more one, 900 is about half.
    • When using dynamic batching, vertex can only be combined with the CPU, so vertex cannot be too many
    • If the scene contains a lot of text maps, you can use the program to splice texture. If the uv is over (0, 1), the texture will be very difficult.
  • The occlusion culling scheme of the mobile platform is used in combination with PVS and dynamic objects.
  • Replace foreach with for, because foreach will generate a bunch of iterator
  • Use struct to replace Class, faster than 30 times
  • High-end email support that must be replied in 8 hours
  • You can test the shadowgun model to implement shadow.
  • Next, Unity's roadmap will support the new UI and server.

Unity factory lecturer decryption

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.