{"id":930,"date":"2020-01-11T00:53:54","date_gmt":"2020-01-10T16:53:54","guid":{"rendered":"http:\/\/blog.coolcoding.cn\/?p=930"},"modified":"2020-08-20T15:49:39","modified_gmt":"2020-08-20T07:49:39","slug":"unity%e7%a6%81%e7%94%a8unity-lighting%e4%b8%ad%e7%9a%84auto-generate%e9%80%89%e9%a1%b9","status":"publish","type":"post","link":"https:\/\/blog.coolcoding.cn\/?p=930","title":{"rendered":"[Unity]\u7981\u7528Unity-Lighting\u4e2d\u7684Auto Generate\u9009\u9879"},"content":{"rendered":"\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/blog.coolcoding.cn\/wp-content\/uploads\/2020\/01\/20200110230659723.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u4ee5Unity2018.4\u4e3a\u4f8b\uff0c\u6bcf\u6b21\u65b0\u5efa\u573a\u666f\uff0c\u8fd9\u4e2aAuto Generate\u603b\u662f\u52fe\u7740\u7684<br>Unity\u540e\u53f0\u7684\u81ea\u52a8\u70d8\u7119\u7ebf\u7a0b\u5c31\u4e00\u76f4\u5728\u8fdb\u884c\uff0c\u7136\u540e\u7535\u8111\u5c31\u5361\u5361\u5361\uff0c\u8fd9\u771f\u662f\u4e00\u4e2a\u60b2(\u5931)\u4f24(\u8d25)\u7684\u8bbe\u8ba1<\/p>\n\n\n\n<p>\u5982\u4f55\u7981\u7528\u8fd9\u4e2a\u529f\u80fd\uff08\u52fe\uff09\u5462\uff1f\u628a\u8fd9\u6bb5\u4ee3\u7801\u653e\u8fdb\u5de5\u7a0b\u5c31OK\u4e86\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>using UnityEditor;\nusing UnityEditor.SceneManagement;\nusing UnityEngine.SceneManagement;\n\n[InitializeOnLoad]\npublic static class EditorDisableAutoGenerateLighting\n{\n    static EditorDisableAutoGenerateLighting()\n    {\n        EditorSceneManager.sceneOpened += OnSceneOpend;\n        EditorSceneManager.newSceneCreated += OnSceneNewCreate;\n    }\n\n    private static void DisableAutoGenerateLighting()\n    {\n        Lightmapping.giWorkflowMode = Lightmapping.GIWorkflowMode.OnDemand;\n    }\n\n    public static void OnSceneOpend(Scene scene, OpenSceneMode mode)\n    {\n        DisableAutoGenerateLighting();\n    }\n\n    public static void OnSceneNewCreate(Scene scene, NewSceneSetup setup, NewSceneMode mode)\n    {\n        DisableAutoGenerateLighting();\n    }\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u4ee5Unity2018.4\u4e3a\u4f8b\uff0c\u6bcf\u6b21\u65b0\u5efa\u573a\u666f\uff0c\u8fd9\u4e2aAuto Generate\u603b\u662f\u52fe\u7740\u7684Unity\u540e\u53f0\u7684\u81ea\u52a8\u70d8\u7119\u7ebf [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts\/930"}],"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=930"}],"version-history":[{"count":1,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts\/930\/revisions"}],"predecessor-version":[{"id":932,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts\/930\/revisions\/932"}],"wp:attachment":[{"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=930"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=930"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=930"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}