Unity3d Basic Optimization Entries

Source: Internet
Author: User
Tags modulus

It's hard to write a blog post with Marsedit on a Mac, just like the format on Windows Live Writer, and you'll have to take notes later as a post, stick to handwriting, and eliminate lazy copying.
almost all of our optimization concepts tell us????? First, to run a smoother program is to sacrifice more memory, as a cost, with memory for smooth, for example, near the texture of high quality, far from the use of low-quality stickers (mipmap), near the use of high-modulus distance using low-modulus (Lod)??? Second, swap the CPU for memory, for example, if the resource is not used, and then use such as: Resource.unloadunusedasserts or GC release, but this call can be very frequent, increasing the CPU burden destory??? third, the rational use of looking at the project needs, optimization is a purpose, as a developer can grasp the most basic optimization routines, and then follow the specific needs of the project as appropriate considerations
????? Simply consider the three aspects of resources, the engine aspect, the code aspect ??The Art of resources? Dynamic Object {
number of control patches 300-2000 control skinned mesh for one control material quantity 1-3 control bones number less than 30
?}? Static object {The number of vertices that control the mesh is less than 500 marks for static,static batching interior will be optimized, for example three object tag static will be rendered in a drawcall note: Even if static is used, Different shader will add Drawcall, add a different type of material (even if the material uses the same shader), add a drawcallanimation component to try not to attach?}?Texture {self-contained terrain control resolution map height size less than 257less than four mixed textures used in terrain texturestexture format in compressed formattexture size less than 1024x768It is recommended to use mipmap, although it will increase the size of the program but will improve rendering efficiency, file size will increase to 133%, so make a choice(a picture to understand mipmap)?}? Audio
Play long music using. ogg. mp3 Time is relatively short with. wav. AIF
?}???engine-Side optimization? light Source Setting {The number of control lights under the premise of satisfying the effect important the number of light sources (optional at render mode under the lights option) try to 1 or no more than the number Drawcall more pixel light count can control the number of affected lights (option in quality Setting > Pixel light Count) using LOD (multi-level of detail)?}? Camera settings {Set a reasonable trimming range occlusion culling??}? Particle optimization {The total number of particles on the screen does not exceed 200 recommended that each particle emitter emit no more than 20 particles of size as small as possible, for very small particles can be removed from the particle map of alpha?}? Physics engine Optimization {Collision Body optimization use spherical box collisions to avoid mesh collider?}? Render optimization {Avoid using alpha Test with alpth blend, if you use alpth instead of alpha test, if you cannot replace the pixel of alpth test to a minimum drawcall batching Unity can combine some objects when rendering, thus using a drawcall?static batching to the static object batching no size limit to the geometry data, the principle static verterx+ dynamic index buffer to merge the same material In a large vetexbuffer, note that using Stati cbatching will increase memory overhead to store the data after batch? Dynamic object unity will automatically batching to it, the principle Dynamic Vertexbuffer+indexbuffer Note that only mesh objects smaller than 900 vertices are currently supported, and if shader uses POSITION,NARMAL,UV three properties, objects below the smart batch 300 vertex, if the Use position,normal,uv,uv1,tangent and other attributes to only batch180 objects below the vertex? Scaling objects cannot be batch with non-scaled objects? Texture merge texture batching??code optimization Aspects
1. Call time.framecount%x==02 once every x frames. Use the invokerepeating function to execute the invokerepeating ("dosometing",. 5f,1f) 3 Every 1 seconds after starting. 5 seconds. Use multiplication instead of Division 4. Reasonable use of GC, frequent GC calls will increase the burden on the CPU, do not manually call only when the memory reaches a certain threshold GC will be called when it is run, that is, when we do the action of switching the scene is manually called?

Unity3d Basic Optimization Entries

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.