cocos-docs
cocos-docs copied to clipboard
how is resource uuid determined?
URL : https://github.com/cocos-creator/creator-docs/blob/master/en/advanced-topics/meta.md
how is uuid determined? md5hash(file path)? or sha256Hash(file path)?
We used UUID to keep the resource pathless. So it can't use file path calculation.
This is the standard for UUID, and we are using version V4. It's random~ https://en.wikipedia.org/wiki/Universally_unique_identifier
We used UUID to keep the resource pathless. So it can't use file path calculation. This is the standard for UUID, and we are using version V4. It's random~
It could not be random. if it is random, a one png file, another build will give a different uuid. then this will break down the hot update. Or if it is random, how to keep it consistent across different build?
Can you show me the code where the uuid is generated?
or I guess at least the seeds used to feed the random generator is determined, otherwise, there is no way to keep uuid consistent across different build.
The UUID is generated randomly when the engine detects the file doesn't have the corresponding meta file. once the UUID is generated, it will be stored in a meta file with the same name file. For example,
a.png
will have a meta file named a.png.meta
Make sure the *.meta files are under the source version management, such as SVN, Git etc.
If a file will a *.meta file, the UUID will be never re-generated. if a file missed its *.meta file, a new UUID will be generated randomly.
To conclude , the most important thing is take care of the meta files, don't miss them.
Thanks for your asking, I hope this can help you get rid of confused.