{"id":367,"date":"2019-01-22T19:44:10","date_gmt":"2019-01-22T11:44:10","guid":{"rendered":"http:\/\/www.kejidana.com\/?p=367"},"modified":"2019-01-22T19:44:10","modified_gmt":"2019-01-22T11:44:10","slug":"%e5%91%bd%e4%bb%a4%e8%a1%8c%e7%bc%96%e8%af%91unity%e9%a1%b9%e7%9b%ae","status":"publish","type":"post","link":"http:\/\/www.kejidana.com\/?p=367","title":{"rendered":"\u547d\u4ee4\u884c\u7f16\u8bd1unity\u9879\u76ee"},"content":{"rendered":"<p>\u5728Assets\/Editor \u4e0b\u521b\u5efaCommandBuild \u6587\u4ef6<\/p>\n<pre class=\"lang:c# decode:true\">using UnityEditor;\nusing UnityEngine;\nusing UnityEditor.Build.Reporting;\n\npublic class CommandBuild : MonoBehaviour\n{\n    [MenuItem(\"Build\/BuildWebGL\")]\n    public static void BuildWebGL()\n    {\n        BuildPlayerOptions buildPlayerOptions = new BuildPlayerOptions();\n        buildPlayerOptions.scenes = new[] { \"Assets\/Scenes\/Welcome.unity\", \"Assets\/Scenes\/LevelChoose.unity\", \"Assets\/Scenes\/Play.unity\" };\n        buildPlayerOptions.locationPathName = \"D:\\\\web\\\\cardbattle\";\n        buildPlayerOptions.target = BuildTarget.WebGL;\n        buildPlayerOptions.options = BuildOptions.None;\n\n        BuildReport report = BuildPipeline.BuildPlayer(buildPlayerOptions);\n        BuildSummary summary = report.summary;\n\n        if (summary.result == BuildResult.Succeeded)\n        {\n            Debug.Log(\"Build succeeded: \" + summary.totalSize + \" bytes\");\n        }\n\n        if (summary.result == BuildResult.Failed)\n        {\n            Debug.Log(\"Build failed\");\n        }\n    }\n}<\/pre>\n<p>\u5728cmd\u4e2d\u8fd0\u884c<\/p>\n<pre class=\"lang:default decode:true \">\"F:\\Program Files\\Unity\\Editor\\Unity.exe\"  -batchmode -quit -nographics -executeMethod CommandBuild.BuildWebGL   -logFile D:\\web\\cardbattle\\build.log -projectPath \"D:\\project\\PopStar\\workspace\\cardbattle\\project\\cardbattle\"<\/pre>\n<p>\u53c2\u8003\uff1a<\/p>\n<p><a href=\"https:\/\/docs.unity3d.com\/ScriptReference\/BuildPipeline.BuildPlayer.html\">https:\/\/docs.unity3d.com\/ScriptReference\/BuildPipeline.BuildPlayer.html<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728Assets\/Editor \u4e0b\u521b\u5efaCommandBuild \u6587\u4ef6 using UnityEdito [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[29],"tags":[],"class_list":["post-367","post","type-post","status-publish","format-standard","hentry","category-unity3d"],"_links":{"self":[{"href":"http:\/\/www.kejidana.com\/index.php?rest_route=\/wp\/v2\/posts\/367","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.kejidana.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.kejidana.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.kejidana.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.kejidana.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=367"}],"version-history":[{"count":0,"href":"http:\/\/www.kejidana.com\/index.php?rest_route=\/wp\/v2\/posts\/367\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.kejidana.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=367"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.kejidana.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=367"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.kejidana.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=367"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}