1. Update the opacity map compression format for etc 4bit, because the Android market in the mobile phone GPU has a variety of, each home GPU support different compression format, but they are compatible with etc format,
2. For transparent mapping, we can only select Rgba 16bit or Rgba 32bit.
3. Reduce FPS, the VSync Count parameter in projectsetting-> quality will affect your fps,everyvblank equivalent to Fps=60,everysecondvblank = 30;
Both of these situations do not match the game FPS, we need to manually adjust the FPS, first turn off the vertical synchronization of this function, and then in the code of the Awake method manually set fps (application.targetframerate = 45;)
Benefits of reduced FPS:
1) Save electricity, reduce the situation of mobile phone fever;
2) can stabilize the game fps, reduce the situation of lag.
4. When we set FPS, and then adjust the fixed timestep This parameter, this parameter in Projectsetting->time, the purpose is to reduce the number of physical calculations, to improve game performance.
5. Use the update lateupdate fixedupdate as little as possible to improve performance and conserve power. Multi-use events (not SendMessage, using your own writing, or event delegates in C #).
6. When standby, adjust the game's FPS to 1, saving power.
Play a game if you often encounter the crash or the picture is not good, the general user does not want to play down, the reason that this situation can generally be said to be two reasons, the first is their own hardware facilities, the second is the game itself performance; The first reason is that users can choose their own, As for the second reason can only be changed by developers, then how to optimize the performance of the game running? Here is a brief introduction to a few aspects.
In case of trouble, call the "garbage collector" (Garbage Collector, useless unit collector, hereinafter referred to as GC)
We are not accustomed to the specific behavior of the useless unit collector because of the programming background of C + + games. Make sure you automatically clean up the memory you don't use, which is good at first, but soon you'll find your profiler often shows that the CPU load is too large because the garbage collector is collecting garbage memory. This is especially a big problem for mobile devices. To follow up on memory allocations and try to avoid them as a priority, here are the main actions we should take:
1. Remove any string connections in the code, as this will leave a lot of garbage to the GC.
2. Replace the "foreach" Loop with a simple "for" loop. For some reason, each iteration of each "foreach" loop generates 24 bytes of garbage memory. A simple loop iteration can leave 240 bytes of garbage memory 10 times.
3. Change the way we check game object tags. Replace "if (Go.tag = =" Enemy ") with" if (Go.comparetag ("Enemy") ". It is a very bad practice to invoke the tag properties of an object assignment and copy extra memory in an internal loop.
4. The object library is great, we create and use libraries for all dynamic game objects so that nothing is dynamically allocated during the game's runtime, and everything is reversed to the library when it is not needed.
5. Do not use LINQ commands because they typically allocate intermediate retarders, which can easily generate garbage memory.
all useUnity3dThe gameplay code written is script code, which in our project is the C # code that is processed using mono execution time. Any communication requirement to the engine data requires a call to the local engine code that enters the Advanced scripting language. This, of course, generates its own overhead, while minimizing the number of calls in the game code is in the second place.
1. Moving around in this scenario requires a call from the script code to enter the engine code so that we cache the transformation requirements of an object in one frame of the gameplay code and send only one request to the engine at a time to reduce the call overhead. This pattern also applies to other similar places, not only to moving and rotating objects.
2. Referencing a local cache to a component reduces the need to use "getcomponent" for one component reference per game object, which is another example of calling local engine code.
only objects with the same material can be batch-processed. So, if you want to get a good batch effect, you need to reuse the material and objects as much as possible in your program. dynamic batch processing is done automatically and does not require additional action from you. Reminders: 1, batch dynamic objects require a certain amount of overhead on each vertex, so dynamic batching only supports mesh objects that are less than 900 vertices. 2 If your shader uses three properties of vertex position, normal and UV values, then you can only batch objects below 300 vertices; If your shader needs to use vertex position, normals, uv0,uv1 and tangent vectors, then you only batch processing of objects below 180 vertices. Please note: Restrictions on the number of attributes may change in the future. 4, do not use scale scales. Two objects with a scaling scale (1,1,1) and (2,2,2) will not be batched. 5, uniformly scaled objects are not batched with objects that do not have a uniform scaling scale. Two objects using scale scale (1,1,1) and (1,2,1) will not be batched, but two objects using the scale scale (1,2,1) and (1,3,1) will be batch-processed. 6, using instanced objects of different materials (instance) will cause the batch to fail. 7, objects with Lightmap contain additional (hidden) material attributes, such as lightmap offset and scaling coefficients. Therefore, objects that have lightmap will not be batched (unless they point to the same parts of Lightmap). 8, multichannel shader can interfere with batch operations. For example, almost all shaders in unity support multiple light sources in forward rendering and effectively open multiple channels for them. 9, Instances of the Presets automatically use the same mesh model and material. Static batch processing
Static batching is currently supported only with Unity IOS advanced.
"Turn" Android game optimizer based on Unity3d engine (Drawcall)