{"id":6304,"date":"2026-01-24T10:34:34","date_gmt":"2026-01-24T02:34:34","guid":{"rendered":"https:\/\/blog.coolcoding.cn\/?p=6304"},"modified":"2026-03-04T09:17:01","modified_gmt":"2026-03-04T01:17:01","slug":"unity%e5%90%84%e7%a7%8dguid%e9%93%be%e6%8e%a5%e8%ae%b0%e5%bd%95-1","status":"publish","type":"post","link":"https:\/\/blog.coolcoding.cn\/?p=6304","title":{"rendered":"Unity\u5404\u79cdGUID\u94fe\u63a5\u8bb0\u5f55-1"},"content":{"rendered":"\n<p>\u4e00\u822c\u60c5\u51b5\u4e0b\uff0c\u6587\u4ef6meta\u4e2d\u7684GUID\u5373\u4e3a\u8d44\u4ea7\u552f\u4e00ID<\/p>\n\n\n\n<p>\u4f46\u662f\u50cfFBX\u8fd9\u6837\uff0c\u5185\u7f6e\u4e86\u591a\u4e2a\u8d44\u4ea7\u7684\uff0c\u5c31\u4e0d\u80fd\u4f7f\u7528\u6587\u4ef6meta\u7684GUID<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>(string, string) FindFbxMeshGuidAndFileId(string fbxPath)\n{\n    List&lt;string> meshGuids = new List&lt;string>();\n    var allAssetPaths = AssetDatabase.LoadAllAssetsAtPath(fbxPath);\n    foreach(var assetObj in allAssetPaths)\n    {\n        if (assetObj is Mesh)\n        {\n            if (AssetDatabase.TryGetGUIDAndLocalFileIdentifier(assetObj, out var guid, out long fileId))\n            {\n                return (guid, fileId);\n            }\n        }\n    }\n\n    return (string.Empty, string.Empty);\n}<\/code><\/pre>\n\n\n\n<p>\u4ee5\u4e0a\u4ee3\u7801\u5373\u53ef\u83b7\u5f97FBX\u4e2d\u7b2c1\u4e2aMesh\u7684(Guid, fileId)\u5f15\u7528<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u822c\u60c5\u51b5\u4e0b\uff0c\u6587\u4ef6meta\u4e2d\u7684GUID\u5373\u4e3a\u8d44\u4ea7\u552f\u4e00ID \u4f46\u662f\u50cfFBX\u8fd9\u6837\uff0c\u5185\u7f6e\u4e86\u591a\u4e2a\u8d44\u4ea7\u7684\uff0c\u5c31\u4e0d\u80fd\u4f7f\u7528\u6587\u4ef6met [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts\/6304"}],"collection":[{"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6304"}],"version-history":[{"count":2,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts\/6304\/revisions"}],"predecessor-version":[{"id":6326,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts\/6304\/revisions\/6326"}],"wp:attachment":[{"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6304"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6304"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6304"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}