# uuid and dependencies

When the tool imports the resource, it will also add some additional information to the resource and put it in the meta file.

-Assign a unique id: uuid to a file. -And create a .meta file and place it next to the corresponding file. -And put uuid and importSetting in this meta file. -Then compile it based on the information in the meta and the resource file itself.

# uuid and dependencies

uuid is the unique id that represents a file. The tool will continuously monitor whether files are added to the assets directory. When a new resource is placed under the assets directory of the tool, a random value will be assigned as its uuid, and the content will be saved in the meta file, which is regenerated every time it is assigned.

# Dependency between resources

uuid is also used to express dependencies between resources. The uuid of other resources is recorded in the resource. This is called static dependency between resources. The tool can analyze the relationship between resources and resources to achieve automatic subcontracting and other capabilities. Because the compilation process may generate multiple files for one resource, it will also generate a certain new uuid based on the original uuid plus a fixed random number seed. For example, if png is imported as a texture, then two files, png and texture, will exist in the temp directory after compilation. The uuid of the texture is generated by mixing a fixed variable based on the uuid of the png in the assets directory, so that the difference can be guaranteed. The computer can always generate the same uuid to the texture, so as to maintain the correct dependency. If a material resource wants to use a texture resource, what is recorded in the material is actually the uuid of the texture, not the uuid of the png. In fact, the uuid of this texture cannot be found in the Assets directory.

# meta file

The tool will generate a corresponding meta file for all resource files, including folders. It records the uuid and the corresponding import setting. ImportSetting can be seen in the inspector window after being selected in the Project window, and can be modified.

Important: Meta files are hidden in the Project window. When resources are moved in the Project window, the tool will move the meta files together by default. When moving files in the file manager of the operating system, you must remember to move the meta along with it, otherwise the tool will re-allocate the file with a new uuid, resulting in loss of dependency. If meta is deleted actively, a new uuid will also be reassigned. When the dependency is lost, it is necessary to manually re-establish the pointing relationship in the tool.

When multiple people develop, different people may put the same png file in the same location on different computers, but the uuid in their meta files is different. Then when submitting to version management tools, such as svn, git, conflicts will occur. Here, developers need to select one of the uuids as the real uuid of this file, and at the same time correct all resources that reference this png. It is recommended to try not to upload the same file by different people.

点击咨询小助手