{"id":205,"date":"2019-09-01T17:08:44","date_gmt":"2019-09-01T09:08:44","guid":{"rendered":"http:\/\/blog.coolcoding.cn\/?p=205"},"modified":"2020-09-27T17:02:24","modified_gmt":"2020-09-27T09:02:24","slug":"unity2018-4%e7%9a%84prefab-variantprefab%e5%8f%98%e7%a7%8d%e5%8a%9f%e8%83%bd","status":"publish","type":"post","link":"https:\/\/blog.coolcoding.cn\/?p=205","title":{"rendered":"[Unity]Unity2018.4\u7684Prefab Variant(Prefab\u53d8\u79cd)\u529f\u80fd"},"content":{"rendered":"\n<p>Unity 2018.4\u4e2d\u9001\u4e86\u4e00\u4e2a\u65b0\u7684\u529f\u80fd: Prefab&nbsp;Variant<\/p>\n\n\n\n<p>\u601d\u8def\u662f,&nbsp;Prefab Variant&nbsp;\u7ee7\u627f\u4e8e\u4e00\u4e2a\u7236Prefab,&nbsp;\u7236Prefab\u5c5e\u6027\u4fee\u6539\u540e:<\/p>\n\n\n\n<p>(1)\u5982\u679c\u5b50Prefab\u7684\u67d0\u4e9b\u5c5e\u6027\u4e0d\u52a8,&nbsp;\u5219\u7236Prefab\u7684\u5c5e\u6027\u5f71\u54cd\u5b50Prefab\u7684\u5c5e\u6027,&nbsp;\u6b64\u4e3a [\u5c5e\u6027\u7ee7\u627f]<\/p>\n\n\n\n<p>(2)\u5982\u679c\u5bf9\u5b50Prefab\u7684\u67d0\u4e9b\u5c5e\u6027\u8fdb\u884c\u4fee\u6539\/\u8986\u76d6,&nbsp;\u5219\u7236Prefab\u7684\u5c5e\u6027\u65e0\u6cd5\u5f71\u54cd,&nbsp;\u6b64\u4e3a [\u5c5e\u6027\u5b9a\u5236]<\/p>\n\n\n\n<p>\u521b\u5efaPrefab Variant\u7684\u65b9\u6cd5\u4e3a:&nbsp;\u628aPrefab\u4eceHierarchy\u518d\u6b21\u62c9\u5230Project\u4e2d,\u9009\u62e9&nbsp;Prefab&nbsp;Variant<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"411\" height=\"164\" src=\"http:\/\/blog.coolcoding.cn\/wp-content\/uploads\/2019\/09\/2-1.png\" alt=\"\" class=\"wp-image-206\" srcset=\"https:\/\/blog.coolcoding.cn\/wp-content\/uploads\/2019\/09\/2-1.png 411w, https:\/\/blog.coolcoding.cn\/wp-content\/uploads\/2019\/09\/2-1-300x120.png 300w\" sizes=\"(max-width: 411px) 100vw, 411px\" \/><\/figure>\n\n\n\n<p>\u7528\u5904\u4e3e\u4f8b:<\/p>\n\n\n\n<p>\u6bd4\u5982\u505a\u4e00\u4e2aUGUI\u7a97\u4f53\u6a21\u677f,&nbsp;\u4e0a\u9762\u6709\u6807\u9898\u6587\u5b57\u548c\u5173\u95ed\u6309\u94ae<\/p>\n\n\n\n<p>\u90ae\u4ef6\u7a97\u4f53\u7ee7\u627f\u4e8e\u6b64\u7a97\u4f53\u6a21\u677f,\u5236\u4f5c\u6210\u4e3a\u4e00\u4e2aPrefabVariant,&nbsp;\u4f46\u662f\u6807\u9898\u6587\u5b57\u5b9a\u5236\u4fee\u6539\u4e3a&#8221;\u90ae\u4ef6&#8221;<\/p>\n\n\n\n<p>\u8fd9\u65f6,\u53ef\u4ee5\u901a\u8fc7\u4fee\u6539\u7a97\u4f53\u6a21\u677f\u4e2d\u7684\u5173\u95ed\u6309\u94ae,\u5bf9\u6240\u6709\u6d3e\u751f\u7684\u7a97\u4f53\u6309\u94ae\u8fdb\u884c\u4fee\u6539<\/p>\n\n\n\n<p>\u9644:\u4ee5\u4e0b\u4e3a\u5b98\u65b9\u5bf9PrefabAssetType\u7684\u89e3\u91ca:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\n    public enum PrefabAssetType\n    {\n \n        \/\/\n        \/\/ \u6458\u8981:\n        \/\/     The object being queried is not part of a Prefab at all.\n        NotAPrefab = 0, \/\/ \u4e0d\u662fPrefab\n \n        \/\/\n        \/\/ \u6458\u8981:\n        \/\/     The object being queried is part of a regular Prefab.\n        Regular = 1, \/\/ \u5e38\u89c4\u7684Prefab\n \n        \/\/\n        \/\/ \u6458\u8981:\n        \/\/     The object being queried is part of a Model Prefab.\n        Model = 2, \/\/ \u6a21\u578b(\u4f8b\u5982:FBX)\n \n        \/\/\n        \/\/ \u6458\u8981:\n        \/\/ The object being queried is part of a Prefab Variant.\n        \/\/ A Variant Prefab is a Prefab that is derived from another Prefab, \n        \/\/ that be could be a Regular, Model or even Variant Prefab.\n        Variant = 3, \/\/ Prefab\u53d8\u79cd\n \n        \/\/\n        \/\/ \u6458\u8981:\n        \/\/     The object being queried is part of a Prefab instance, but because the asset\n        \/\/     it missing the actual type of Prefab can\u2019t be determined.\n        MissingAsset = 4 \/\/ Prefab\u5b9e\u4f8b\u5316\u51fa\u6765\u7684\u5bf9\u8c61,\u4f46\u662fPrefab\u88ab\u5220\u4e86(\u7ea2\u8272)\n    }<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Unity 2018.4\u4e2d\u9001\u4e86\u4e00\u4e2a\u65b0\u7684\u529f\u80fd: Prefab&nbsp;Variant \u601d\u8def\u662f,&nbsp;Pr [&hellip;]<\/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":[18],"_links":{"self":[{"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts\/205"}],"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=205"}],"version-history":[{"count":3,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts\/205\/revisions"}],"predecessor-version":[{"id":2664,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts\/205\/revisions\/2664"}],"wp:attachment":[{"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=205"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=205"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=205"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}