Unity summarizes some of the pits that unity encounters

Source: Internet
Author: User
Tags serialization svn svn update stringbuffer
 reprint address: http://blog.csdn.net/gy373499700/article/details/48750973 
1. Client monthly card display problem due to communication problems caused by the AppStore product ID was deleted, the parties confirmed that Apple's Product ID transformation must be retried, to increase the ID discovery client ID was written dead. Finally, only one ID can be reduced to a monthly card.

So the client wants to be dynamic. 2.NGUI Mobile is inefficient, the dynamically moving sprite results in a low Ngui ordering per frame, so the icon and text on the player's head in the main city must be made with render and 3dtext.

So Ngui is only suitable for static UI. 3.iOS Resource Decompression path problem due to pre-project busy issues. Plan to audit the time the resources exist in the TEMP directory, the document directory after the launch, the result becomes the storage temp directory. Causes players to re-download resources every few days because the TEMP and cache directory systems are automatically emptied.

So we have to update the version temporarily. 4 on the planning of the difference between Okmsgbox and Tipsbox, before asked some planning they feel like no difference, the recent operation of the feeling is frequent operation tips and not important tips to facilitate the player operation, infrequent and more important tips must be MsgBox tips,

Make sure the player sees the content. 5 about file updates, file updates often encounter cache problems update, such as configuration table BUNDINFO.TX Many CDN will optimize if the name of the second time will not re-download the read cache, so it is best to change after each file suffix name, _1, file name CRC suffix check will change and so on.

In addition to testing the time required to update the egg pain, the same name of the resources just put on the server down, wait a while maybe down. 6 about the Android code DLL update, the first computer connected to Android phone look at the resource manager when the Android resources are very late, generally by mobile phone or assistant to look at the directory.

In addition, DLL update to restart, there is the APK package DLL and update the download DLL at the Java level to determine which is the right, such as generally the following, but meet the new apk will be downloaded after the deletion of the local to prevail.

      7 about the Android code hot update Pit: Since we are using serialization of code, in the case of a large version update that only wants to update the DLL, you must ensure that the individual public member variables of the code serialization are the same:

      A. The original code cannot increase the public variable, nor can the public variable attribute be changed, and the public variable is used to obtain the function. B. If you change a lot of variables, it is recommended to delete the original code to add a _1 code, such as Test.cs into Test_1.cs. However, this is to ensure that the code's meta file GUID is the same, that is, the original code to change the meta-_1.meta. Since the GUID is considered entirely new after it has changed, all the resources associated with that code will change, causing too many updates to the file. Also make sure that the original code and objects changed to _1.cs are not assigned directly to public.

      Otherwise, referencing objects can also cause resource changes.

C. Be sure to re-hit all resources associated with this code after the code has been modified. 8 Client Compute Server time variable type encountered pit: The server's time client was originally calculated using the Uint64 type, and then found that the calculation error changed to the ulong discovery is also wrong, in fact, the 2 are similar, mainly because the calculation produced a negative number, Causes the negative number of the UINT64 to become a large positive number and makes a mistake. So in fact, the client normal logic with int64 or long should be enough.

Int64 and long are the same purely from the numerical range. 9 regarding the client's Itemdb, the client often needs to get the partial sorting and sorting processing of the items inside, if new objects are returned each time it gets or sorts, the client's memory will be full in a short time.

Therefore, it is common to define the type variable at the interface where it is obtained, clear off and then return each time it is fetched or sorted, so that memory redundancy is not caused. 10 read file in bundle mode there is a problem with the PC mode file correctly. Equipment model in the PC inside the normal load on the phone does not come in because the resources of the picture and model or material name, the bundle inside does not distinguish the suffix name, so loaded the wrong file and failed.

The solution is to add the suffix of all types of files, or you can load them by pressing typeof () to load the resources. 10.2 about renaming the model map and material, the map name can be changed arbitrarily, but the material name is generated based on the model's material naming field, such as by Texture name, but the Texture name here is not the name of the map seen in unity

But the art of the export project when the name of the map, irregular art will often be the model map material names default to the same, so material naming can choose the model name + material name, and then reimport this resource material is automatically generated. 11. Set Sprite picture not to go in, by this problem pit dead set a go in anyway or the original look no place to modify. To the last discovery is due to the UIButton normal state of the parent layer, resulting in no modification success. So it's best that the 2-side spritenameReset it again. 12. The better the resolution and GPU the better the performance of the lower the power consumption problem, it is likely that the quality setting set to automatic so shader resolution will be automatically set to high resolution will be very card, the solution is all set to fastest mode, 13 about Art uploaded files, the program from SVN download down stickers are always wrong, the past can not solve the art is to manually solve the problem again. Recently found that it is possible that the SVN upload is incomplete, some files such as. A files or some material files, such as. A file or some materials are not active add and upload, so the art of the machine seems to have uploaded, in fact, into each of the underlying directory found some material files

There may not be an add upload. 14.c# encountered using if (false) {} and then caused an error: location of the symbol related to previous warning. may be optimized by the compiler.

Don't write like that. 15.Mprotect remapping failed This error refers to the underlying memory allocation exception, which causes the frequent destruction of the cause and the creation of a large number of objects.

The solution is to distribute operations, such as the first frame destruction, and so on 2 frames and then create a combination of co-operation on the line. 16. With regard to shader, the bundle pattern was used before, and shader with dependencies that were not in the Shaderlib library would be packaged. The new file system will not be packaged under the Shaderlib or the $ symbol, but the art has a large number of uses such as the system comes with some particleshader. Workaround: 1Project Setting graphicssetting inside can define always Inculde Shader, can include system Shader. 2. You can define a global object in the login scene to reference the shader, and the package will be automatically scored.

3. Place the shader in the resource directory or on the prefab to place the resource directory.

17. About the material's render queue Custom render Que, if the material's Que has a value of 1, then the material's queue to render, modify shader is useless, if que=-1 is to be rendered with shader render queue. 18. File system description file more than 10,000 lines, using StringBuilder instead of string after the speed of 27 times times faster. Comparison of the three in the speed of execution: StringBuilder > StrinGbuffer > String. A summary of the use of the three: 1. If you want to manipulate a small amount of data with = String 2. A single-threaded operation string Buffer operates in large amounts of data = StringBuilder 3. Multithreading operations string buffers operate large amounts of data = StringBuffer, 19. About BIGF Ile use, Android edge Streamingasset directory belongs to compression type load slower, at some load speed requirements of the resources must be copied to the persistent directory to load. iOS inside the same speed, but if the iOS storage is RAR Compressed files are also recommended to extract to the persistent directory to load.

Bigfile is the manual definition of which files load frequently or affect speed. 20. About Fine Art modification effect Prefab map re-specify the upload prefab after the SVN update down found that the effect has not been modified successfully, because the special effects of the map information is present on the material, so modify the prefab map specified can not simply upload prefab

Also need to upload material files, in order to ensure that others update SVN after the effect of normal display.   21. Description of Plane vectors and distances Plane p=new Plane (PO1,PO2,PO3); Plane q=new Plane (PO3,PO2,PO1); 2 plane normal vectors p.normal instead, it is determined by the left-handed rule of our high school, according to the direction of the three points to be worn, clockwise inward, counterclockwise outward.

Unity inside the representation of the plane is determined by the normal vector and his offset, that is, the p.normal and P.distance offset is a positive representation in the direction of the normal vector offset, negative for the normal vector inverse direction offset. 22. About the creation of mesh: Draw Graphics.drawmesh (mesh,vector3.zero,quaternion.identity, amaterial, 0), where the material and mesh can be assigned values. Mesh is composed of triangles, main parameters mesh.vertices:vector3[] and mesh.triangles:int[]; all Dot index and triangle index, triangle Index array triangles is a multiple of 3 That is, every three ID index corresponds to the specific point coordinates inside the vertices. Guideline: The triangle has two sides, the front is visible, the back is not visible.

	The rendering order of triangles and the front normals of the triangles are left-handed spirals. Mesh.vertices = [Vector3 (0,0,0), Vector3 (0,1,0), Vector3 (1, 1, 0)];
		Mesh.triangles = [0, 1, 2];

Graphics.drawmesh (Mesh, Vector3.zero, quaternion.identity, amaterial, 0); 23. File update system found a major bug, for the location of the file storage is divided into Streamasset and Persistentpath and Serverpath, the final use of the Info property is guaranteed by the server is correct, local do not need to update the assignment PageID Offset etc to Serverpath. The error is that the Persistentpath file in the repackage re-save the process of rewriting the properties of the file is only addressed to the local is not addressed to Serverpath, using the first assignment to rewrite the data in the wrong order. The data offset is always wrong after the page is updated. So you should set the delete first and then repackage to write the file and assign the value to Serverpath finally. In addition, according to our current update mode, offset is saved at the time to calculate the front of the error after the data can all be offset, although this bug is not caused by this, but I think we should start to figure out the specific offset and ID of each file,

Then the download and read offset must be fixed and will not change this error point, and easy to locate the problem. 23. The problem of Xcode packaging error Unable to insert a new project directly into the old project is Branch Island. No insertion point available. For architecture ARMv7: According to Baidu is basically because the code is too large, there are ways to modify the stripping level or move the code to the plugins directory is feasible, but I do not test, it may be too much code.
The final solution is to modify the Scriptingbackend to Il2cpp.
24. Whether the load resource needs to be instantiate, after instantiation will certainly produce 2 parts of memory, directly after the load of the memory pool inside, only the object is instantiated to be available, but for mapping and other reference resources do not need to be instantiated directly available. 25. About the drawbacks of initializing with awake: We often initialize some gameobject relationships in awake, but when the resource load completes, the initialization execution function of the code is called, and the awake does not execute, which causes the initialization of the logic to fail, so the best isThe initialization relationship is also placed in front of the logic initialization to make a judgment. 26. About Ngui's Uiscrollview pit, when doing the task panel, the UI will float a layer of special effects with the uitexture. Because the Uitexture map does not have the original size, the Uiscrollview calculation is based on the widget's high and wide calculations causing the sliding position to always be incorrect.

So make sure that the texture inside is full, there will be no visual size and widget actual size difference. 27. about how to frequently read compressed files to create bundles, build size 2 memory pools to save read byte[] and byte[after decompression], and then copy the extracted byte[] to create bundles. The reason for doing this 1.bundle created memory is not released so it cannot be extracted directly on the create. 2 decompression before the size of the decompression does not know how to create the specific memory, so need to extract to the pool and then copy. 3 of course, if you know in advance the size of the decompression can be created in real-time without the copy process, so the configuration file is best to save the compression and decompression after the length, but now only a length is saved.

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.