Unity3d Summary of optimizations on iOS

Source: Internet
Author: User

Http://www.58player.com/blog-635-122.html

The most recent time I've been doing unity's resources on iOS is to get the most out of Unity's official documents and the actual problems that I've encountered, and I've put myself in the following list of important information that I can quantify to make it easier for more friends who need to be better.

1. Role

Use one skinned Mesh Renderer per character

This is because when a character has only one skinned mesh renderer, Unity uses a method of visibility clipping and wrapping updates to ease the movement of the character, which only happens when the character contains only a skinned mesh renderer.

Number of characters material

2-3

Number of bones

Less than 30

Number of patches

300-1500

The general character should have no IK

This is because most of the character's movements are pre-programmed and do not require an IK operation (except for rogdoll), so do not bring the IK end together when the model is introduced.

2. Meditation

Do not attach animation Component

Attaching a animation component to a static state does not affect the result, but it increases the amount of CPU to be used to adjust the unit, so try to get rid of it.

Mesh vertices

Less than 500

UV value range do not exceed (0, 1) area

The maximum amount of UV value is not crossed, which is helpful for the texture to be flattened.

3. Topography

The resolution size of the terrain

The length and width are as low as 257. This is because the terrain is too large to create a large number of vertices, which will have a certain impact on your internal storage, in the current iOS equipment, the memory is very limited, the need to save a lot of savings. At the same time, if you are using Unity's own terrain, you must also use occlusion culling, because unity's brush terrain tool is convenient, but it is framekiller, and after that, you will notice that the drawcall is increasing a lot.

Mixed texture Number

Not over 4. The blending of the terrain is very time consuming and should be avoided as much as you should. The texture that can be combined and the amount of the same.

4. Texture Management

Texture format

Suggest PNG or TGA. Don't turn it into the PVRTC format supported by iOS hardware, because unity will help you spin it when it's being developed.

Texture size

The length of the width is less than 1024. At the same time should be as small as possible, enough to use, in order to guarantee the texture of the memory of the width of the impact of the smallest.

Support Mipmap

Suggestion to generate mipmap. While this approach increases the size of some application programs, in the game, the system needs to use MIPMAP to render, and reduce the amount of memory and bandwidth.

Check alpha value

If the alpha channel of the texture is 1, the RGB 24-bit texture is used instead of the 32-bit texture of RGBA. (according to the self-test in unity.)

5. Light source

Light source "Important" numbers

Recommend 1, generally for directional light. The smaller the Important, the less. The more numbers, the more drawcall.

Pixel Light Digital Mesh

1-2.

6. Particle effects

Maximum number of particles on the screen

The suggestion was less than 200 particles.

The maximum number of particles per particle emitter

There are no more than 50 suggestions.

Particle size

If possible, the size of the particle should be as small as possible. Because unity's particle system shader is either alpha test or alpha blending is a very small opening. At the same time, for very small particles, the particle texture is suggested to remove the alpha channel.

Do not start the particle collision function.

Very time-consuming.

7. Audio frequency

Play longer music in the game (e.g. background music)

Use the. ogg or. mp3 compression format.

Shorter music (such as a gun)

Use the uncompressed audio format for. wav and. AIF.

8. Phase Machine

Clipping plane

Set the remote plane to the appropriate distance. The far plane will add some unnecessary objects to render, reducing the efficiency.

Set different far clipping planes according to different objects

Unity provides the ability to set different view distance depending on the layer, so we can actually divide the object into layers, the larger object is set to a larger distance, and the smaller layers can be set to a smaller size, in addition, Some larger bodies, such as the particle system, can be set smaller and so on.

9. Collision

Do as much as you need meshcollider

If possible, do not use Meshcollider to save unnecessary marketing. If you can't avoid it, try to replace it with fewer mesh patches or a less-faceted agent.

10. Other

Drawcall

It is possible to reduce the number of drawcall. iOS is not designed for over 100. The main ways to reduce this are: Frustum culling,occlusion culling,texture Packing. Frustum culling is built in unity, what we need to do is to find a suitable far clipping plane, occlusion culling, masking retainer, unity embedded Umbra, a very good OC library. But occlusion culling is not universal, and sometimes it is slower to do OC than not, it is recommended to make sure your scene is suitable for the use of OC before OC, Texture Packing, or Texture atlasing, is to combine the same shader texture to reduce draw call by the nature of Unity's static batching. Suggested use, but also has the disadvantage, that is must have the scene in the distance from the similar physical texture to go together, otherwise, after the piece is likely to increase each frame renders the necessary texture size, enlarges the memory belt the burden. This is why the "Drawcall is down and the rendering speed is slowing down".

The non-sports object is marked with a static signature.

Unity acts as a self-superiority for the static object, so it is possible to hook the non-physical entity to the static signature.

Use prefab as possible in the scene

It is possible to use prefab to reduce the burden of storage and forgiveness. Check the prefabtype of the physical, and try to change it into prefabinstance instead of modelprefabinstance.

Note: The advantage is an endless process, can be the advantages of the project there are many many, such as the foot of the superiority, shader and so on, which are left to add slowly.

Original link: http://rritw.com/a/caozuoxitong/OS/20120426/160528.html

Unity3d Summary of optimizations on iOS

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.