Unity3d some optimization combat on mobile devices (i)-Overview

Source: Internet
Author: User

Turn from: Unity3d Some optimization combat on mobile devices (i)-Overview http://blog.csdn.net/leonwei/article/details/39233921

Project into the medium-term, it is necessary to the program on the mobile device performance analysis and evaluation and targeted optimization, first of all to do optimization, a lot of bottlenecks did not show up, can do things not much, and many indicators will be expected, if too late to do optimization will be too late, to find some problems to change the amount of rework is too big. A while ago spent a lot of time from CPU GPU memory startup time to calorific value the project did a large-scale physical examination and optimization, the effect is significant, here to make a note, the future development projects can be as experience and early attention

1. Project situation: The author of the project is a very heavy hand tour, and even began to aim at the end of the tour do, 3D World, 2.5D perspective, RPG, even if the fight, fine art quality requirements (high-precision model mapping, more than the current market similar products). For most mobile devices today, the challenge is a challenge to the various hardware of the handset. 、

2. Target model: High-end, try to be compatible with low-end, Android at least Sumsung S3 fluent, iOS at least iphone4s fluent.

3. Performance indicators: Memory consumption of less than 250M (so that a large number of 512 of the machine will not hang off), the initial package of 100m (too much operation is not dry, too little is not fit. )

Some of the tools used to analyze and test performance:

1. The first is Unity's statics window under the editor: Provides a view of the two important indicators of DC and vertex count. The disadvantage is not visible to the device, but for the number of DC and vertex, the device and the editor are about the same, using it to roughly see the pressure of the rendering.

2.unity comes with Profiler: You can connect the device to see the CPU GPU mem information on the device, you need to check the development mode when using. A bit is CPU occupies at the level of the script to look very carefully, which function takes too much time to see, basically is the best tool to analyze the efficiency of the script, but most of the GPU device does not support to see, the display of mem information is not very accurate, basically deviate from the actual occupied memory

3.unity Internal Profiler: On the playersetting can check this option, check, connect the device, in the Android adb or Mac Xcode every few seconds to print a lot of key indicators, this is actually very useful, However, this feature was not found until very late, detailed documentation see http://docs.unity3d.com/Manual/iphone-InternalProfiler.html

The ADB:ADB on 4.android offers a very powerful set of tools for separating Android programs, http://developer.android.com/tools/help/adb.html

And the most commonly used is the Dumpsys directive of ADB, https://source.android.com/devices/tech/input/dumpsys.html

The most common include: adb shell Dumpsys meminfo appname View real-time memory consumption, Android memory is divided into PS RS, we generally see PS, about PS RS These concepts can be see http://stackoverflow.com /questions/2298208/how-to-discover-memory-usage-of-my-application-in-android

ADB shell Dumpsys cpuinfo appname View real-time CPU usage, note that the CPU here may be over hundred, this is because of multicore reasons

ADB shell Dumpsys gpuinfo appname View real-time GPU scenarios

Monitor for 5.android

After installing ADT, the Sdk\tools\ There is a monitor below Monitor.bat, which I think is one of the best tools for Android to see performance, because it is graphical and basically integrates the functions of the ADB, from memory to CPU to GPU, and has a very useful network traffic usage, its CPU consumption is C + + Level of statistics, not see the script, which needs to break through that profilor combination.

Mongkey test on 6.android: It can simulate random user input to verify the robustness of your program.

adb shell Monkey-p-V Packname 1000
Randomly simulate 1000 user events

The tools on the 7.ios:ios are more professional and unified, and iOS uses the instruments that comes with Xcode.

Here's a detailed document https://developer.apple.com/library/mac/documentation/developertools/Conceptual/InstrumentsUserGuide/ Introduction/introduction.html

It seems that so many tools, in fact, many are to use, do u3d development, in fact, not just learn to u3d things, to let U3d in the mobile phone running good, but also need to have a deeper understanding of each platform.

Using these tools to normal a number of bottlenecks, but also to take a variety of strategies to improve performance, anyway, the goal is to reduce CPU consumption, memory footprint, start fast, low heat, high frame rate, GPU occupies less, found some problems and make some specific efforts are listed as follows:

1. Use Assetbundle to realize resource separation and sharing, to control the memory in 200m, but also to realize the online update of resources

2. Vertex count for rendering both CPU and GPU are the most stressed contributors, reducing the number of vertices to less than 80,000, FPS stabilized to about 30 frames

3. Use only one dynamic light, not shadow, no light probe

The particle system is the big head on the CPU.

4. Trim particle system 5. Merging simultaneous particle systems 6. Animator is also an inefficient place to implement lightweight particle systems 7. Use animation where you don't need to transition to skeletal animation and motion, and control the number of bones below 30 8.animator out of the field 9. Delete Meaningless animator 10.animator initialization is time-consuming (animator can be used on particles) 11. Do not move with the skeleton except the protagonist apply root motion 12. Absolute prohibition of the movement of objects without a rigid body with bounding box (Static collider) Nugi code efficiency is very poor, basically runtime when the CPU contribution and render the same as 13 per frame recursive calculation Finalalpha to only initialize and change the calculation of 14 minus normal calculation 15 do not calculate per frame viewsize and Windowsize16filldrawcall when building a vertex cache using ARRAY.COPY17. Code clipping: Using the Strip level, use. net2.0 subset18. Minimize smooth Group19. To set a strict scientifically validated art standard for fine arts, and in the u3d with the corresponding inspection tools the articles behind them will be discussed in more detail.

Unity3d some optimization combat on mobile devices (i)-Overview

Related Article

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.