{"id":1563,"date":"2020-03-30T21:36:48","date_gmt":"2020-03-30T13:36:48","guid":{"rendered":"http:\/\/blog.coolcoding.cn\/?p=1563"},"modified":"2020-08-27T11:33:36","modified_gmt":"2020-08-27T03:33:36","slug":"unityfbx%e9%bb%98%e8%ae%a4%e5%af%bc%e5%85%a5%e8%ae%be%e7%bd%ae%e4%bf%ae%e6%94%b9%e5%99%a8","status":"publish","type":"post","link":"https:\/\/blog.coolcoding.cn\/?p=1563","title":{"rendered":"[Unity]FBX\u9ed8\u8ba4\u5bfc\u5165\u8bbe\u7f6e\u4fee\u6539\u5668"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>using UnityEditor;\npublic class EditorFbxImportSetting : AssetPostprocessor \n{\n    void OnPreprocessModel() \n    {\n        ModelImporter importer = assetImporter as ModelImporter;\n        if (importer == null)\n        {\n            return;\n        }\n\n        string name = importer.assetPath.ToLower();\n        string extension = name.Substring(name.LastIndexOf(\".\")).ToLower();\n        switch (extension) \n        {\n        case \".3ds\":\n        case \".fbx\":\n        case \".blend\":\n            importer.importMaterials = false;\n            importer.importCameras = false;\n            importer.importLights = false;\n            importer.generateSecondaryUV = false;\n            importer.swapUVChannels = false;\n            importer.optimizeMesh = true;\n            break;\n\n        default:\n            break;\n        }\n    }\n}<\/code><\/pre>\n\n\n\n<p>\u8fd9\u6837\u7f8e\u672f\u5728\u5bfc\u5165FBX\u65f6\uff0c\u5c31\u4e0d\u7528\u4e00\u4e2a\u4e2a\u52fe\u6389Material\u8bbe\u7f6e\u4e86<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8fd9\u6837\u7f8e\u672f\u5728\u5bfc\u5165FBX\u65f6\uff0c\u5c31\u4e0d\u7528\u4e00\u4e2a\u4e2a\u52fe\u6389Material\u8bbe\u7f6e\u4e86<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts\/1563"}],"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=1563"}],"version-history":[{"count":1,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts\/1563\/revisions"}],"predecessor-version":[{"id":1564,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts\/1563\/revisions\/1564"}],"wp:attachment":[{"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1563"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1563"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1563"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}