Unity profile usage, memory optimization, package size optimization

Source: Internet
Author: User

game optimization is often a more important part of game development, the following share some of their own in performance optimization, memory optimization, package size optimization experience and summary.


Profiler is a unity-brought, used to analyze the game performance, memory usage, such as very good tools, you can accurately locate the impact of game performance of the script method, memory resources, and so on, you optimize the performance of the game, memory has a great help.

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/> one, CPU occupancy analysis


650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M01/85/A5/wKioL1eq6xvyUy-QAALUk0x_bY0687.png-wh_500x0-wm_3 -wmp_4-s_2769604602.png "title=" qq picture 20160810164728.png "alt=" Wkiol1eq6xvyuy-qaaluk0x_by0687.png-wh_50 "/>


As you can see, the frame where the white vertical line is positioned, game.update () occupies 88.3%, if you want to know the script specific call stack, and the specific problem is where the deep profiler needs to be selected for depth analysis, when you open depth profile, All script code will be parsed-that is, all function calls are logged. It is useful to know exactly how much time is spent in your game code. Such as

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M00/85/A6/wKiom1eq7jXxRXHKAAON6nT7ZGY445.png-wh_500x0-wm_3 -wmp_4-s_2099488547.png "title=" qq picture 20160810164728.png "alt=" Wkiom1eq7jxxrxhkaaon6nt7zgy445.png-wh_50 "/>


Second, memory consumption analysis

In the memory bar, you can navigate to a frame, you can see the frame when it is used, it is generally the image of memory, this is just memory, to know that the picture is occupied by the memory, you need to choose detailed

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M00/85/A5/wKioL1eq72WDOXE_AAFj_oAQd0k194.png-wh_500x0-wm_3 -wmp_4-s_679780822.png "title=" qq picture 20160810164728.png "alt=" Wkiol1eq72wdoxe_aafj_oaqd0k194.png-wh_50 "/>


650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M02/85/A6/wKiom1eq8HbCN3jiAADbZc8ZMvg657.png-wh_500x0-wm_3 -wmp_4-s_1913826639.png "title=" qq picture 20160810164728.png "alt=" Wkiom1eq8hbcn3jiaadbzc8zmvg657.png-wh_50 "/>

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M02/85/A5/wKioL1eq8WjzdlZpAAGq-SOr-mA896.png-wh_500x0-wm_3 -wmp_4-s_552059280.png "title=" qq picture 20160810164728.png "alt=" Wkiol1eq8wjzdlzpaagq-sor-ma896.png-wh_50 "/>


Find out which picture is taking up memory, it is good to run, open memory optimization.


Third, memory optimization


From the profiler can clearly see which pictures occupy how much memory, the following will find these pictures, according to the actual situation to optimize the picture, such as compressed pictures, generally speaking, if not the picture is too high, the picture can be compressed to a certain extent. Select the picture, there is a max size, it is limited to the largest picture, this value can generally be adjusted to the actual size of the picture, such as a picture of 1028*720, compressed before the memory size of 3.5mb,max size can be set to 1024, size to 2.3MB, Basically acceptable, even max size can be set to 512, and can even be compressed, the size will become 144KB. Therefore, according to the actual situation of your project, to do some acceptable size adjustment and compression, the optimization effect will be very obvious. The package size also decreases a lot.

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M01/85/A6/wKioL1eq-qGiUof4AAHa7atDevQ883.png-wh_500x0-wm_3 -wmp_4-s_1358009690.png "style=" Float:none; "title=" QQ picture 20160810164728.png "alt=" Wkiol1eq-qgiuof4aaha7atdevq883.png-wh_50 "/>

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M02/85/A7/wKiom1eq-qKTn-YeAAHGdJ2kDcE735.png-wh_500x0-wm_3 -wmp_4-s_3446384018.png "style=" Float:none; "title=" 2.png "alt=" Wkiom1eq-qktn-yeaahgdj2kdce735.png-wh_50 "/>

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M02/85/A7/wKiom1eq-qPQjymBAAHMzBemDNk014.png-wh_500x0-wm_3 -wmp_4-s_3355596539.png "style=" Float:none; "title=" 3.png "alt=" Wkiom1eq-qpqjymbaahmzbemdnk014.png-wh_50 "/>

650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M02/85/A6/wKioL1eq-qOCVk8yAAG6H_pBq90911.png-wh_500x0-wm_3 -wmp_4-s_3679487311.png "style=" Float:none; "title=" 4.png "alt=" Wkiol1eq-qocvk8yaag6h_pbq90911.png-wh_50 "/>


Also, remove the tick in front of the Generate MIP maps option

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M01/85/A6/wKioL1eq_CKxd8nUAABtZ-etDXA849.png-wh_500x0-wm_3 -wmp_4-s_1546170546.png "title=" qq picture 20160810180357.png "alt=" Wkiol1eq_ckxd8nuaabtz-etdxa849.png-wh_50 "/>


Project optimization is a deliberately, or a lot of trying to adjust.

Four, package size optimization

After build, at the top of the console panel right-click->open Editor Log, open the log file, find the package record at the bottom, it records what you have to pack in. This also facilitates your targeted optimization of resources.

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M01/85/A7/wKiom1eq_abjzQ4mAAAkKLxXb2I177.png-wh_500x0-wm_3 -wmp_4-s_3744758115.png "title=" qq picture 20160810180641.png "alt=" Wkiom1eq_abjzq4maaakklxxb2i177.png-wh_50 "/>


650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M02/85/A6/wKioL1eq_xODt7XZAAB2_i7ndGM458.png-wh_500x0-wm_3 -wmp_4-s_18266806.png "title=" qq picture 20160810181630.png "alt=" Wkiol1eq_xodt7xzaab2_i7ndgm458.png-wh_50 "/>


Unity profile usage, memory optimization, package size optimization

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.