Unity Memory Optimization

Source: Internet
Author: User

"Unity Memory Optimization "

1. In the Update method or loop, use the string class less, because each operation of the string class calls new to generate a fresh string object. The use of StringBuilder instead of String,stringbuilder is based on the fixed buffer operation, thus avoiding the allocation of memory.

For example, when you write this code, the compiler actually creates a new string object to hold the new sequence of characters, and the new object is assigned to B. The string "H" will then be appropriate for garbage collection.

  

  

2. The iOS platform uses PVRTC to compress textures. The Adroid platform is compressed using the ETC1 format. can be reduced to 1/4 of the memory size. Optimization is very obvious.

Currently, mainstream Android models support ETC1 format compression. However, ETC1 can only support image compression for non-alpha channels. Therefore, the alpha channel diagram is generally separated out , when plotted to GPU memory, a value is obtained from the Alpha graph, no alpha channel diagram can be used ETC1 compression.

Unity Memory 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.