{"id":6355,"date":"2026-04-11T20:07:47","date_gmt":"2026-04-11T12:07:47","guid":{"rendered":"https:\/\/blog.coolcoding.cn\/?p=6355"},"modified":"2026-04-11T20:35:29","modified_gmt":"2026-04-11T12:35:29","slug":"unity%e5%af%bc%e5%87%bawebgl%e6%b3%a8%e6%84%8f%e4%ba%8b%e9%a1%b9","status":"publish","type":"post","link":"https:\/\/blog.coolcoding.cn\/?p=6355","title":{"rendered":"Unity\u5bfc\u51faWebGL\u6ce8\u610f\u4e8b\u9879"},"content":{"rendered":"\n<h1 class=\"wp-block-heading\">\u5220\u9664\u4e0d\u652f\u6301\u7684\u7b2c3\u65b9\u63d2\u4ef6<\/h1>\n\n\n\n<p>\u4f8b\u5982\uff1a<\/p>\n\n\n\n<ul>\n<li>AVProVideo<\/li>\n\n\n\n<li>WX-WASM-SDK-V2<\/li>\n\n\n\n<li>&#8230;<\/li>\n<\/ul>\n\n\n\n<h1 class=\"wp-block-heading\">\u6253Assetbundle\u5305\uff08WebGL\u5e73\u53f0\uff09<\/h1>\n\n\n\n<p>\u6ce8\u610f\uff1a\u4e0b\u8f7d\u6587\u4ef6\u4f7f\u7528Application.streamingAssetsPath\u4f5c\u4e3a\u7f51\u7ad9\u6839\u76ee\u5f55<\/p>\n\n\n\n<p>\u5373\uff1a\u5982\u679c\u90e8\u7f72\u57df\u540d\u4e3a http:\/\/x.com<\/p>\n\n\n\n<p>\u5219\u5c06Assetbundle\u6587\u4ef6\u90e8\u7f72\u5728 http:\/\/x.com\/StreamingAssets\/ \u76ee\u5f55\u4e2d<\/p>\n\n\n\n<p>\u540e\u7eedWebGL\u5bfc\u51fa\u7684 index.html, Build, TemplateData \u5219\u90e8\u7f72\u5728 http:\/\/x.com \u4e2d<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">\u4e00\u952e\u5bfc\u51fa<\/h1>\n\n\n\n<pre class=\"wp-block-code\"><code>public static void ExportWebGL()\n{\nPlayerSettings.SplashScreen.showUnityLogo = false;\nPlayerSettings.SplashScreen.show = false;\nPlayerSettings.companyName = \"company\";\nPlayerSettings.productName = \"product\";\nPlayerSettings.stripEngineCode = false;\nPlayerSettings.enableInternalProfiler = false;\nPlayerSettings.enableFrameTimingStats = false;\nPlayerSettings.fullScreenMode = FullScreenMode.FullScreenWindow;\nPlayerSettings.WebGL.decompressionFallback = true;\nPlayerSettings.WebGL.debugSymbolMode = WebGLDebugSymbolMode.Off;\nPlayerSettings.WebGL.compressionFormat = WebGLCompressionFormat.Gzip;\nPlayerSettings.WebGL.nameFilesAsHashes = true;\nPlayerSettings.WebGL.powerPreference = WebGLPowerPreference.HighPerformance;\nEditorUserBuildSettings.allowDebugging = false;\nEditorUserBuildSettings.development = false;\nEditorUserBuildSettings.connectProfiler = false;\nEditorUserBuildSettings.buildWithDeepProfilingSupport = false;\nPlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.WebGL, \"\u6839\u636e\u60c5\u51b5\u586b\u5199\");\nvar scenes = new EditorBuildSettingsScene&#91;] { new(\"Assets\/Game.unity\", true) };\nBuildPipeline.BuildPlayer(scenes, \"web\/\", BuildTarget.WebGL, BuildOptions.None);\n}<\/code><\/pre>\n\n\n\n<p>\u5c06\u4f1a\u5728web\u76ee\u5f55\u4e2d\uff0c\u751f\u6210index.html, Build, TemplateData 3\u4e2a\u4ea7\u7269<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">\u6027\u80fd\u95ee\u9898<\/h1>\n\n\n\n<ul>\n<li>Unity URP \u7684WebGL\u53ef\u4ee5\u4f7f\u7528\u5fae\u4fe1\u4f18\u5316\u540e\u7684\u5c0f\u6e38\u620f\u7248\u672c<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">\u517c\u5bb9\u6027\u95ee\u9898<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">\u5c4f\u5e55\u9002\u914d<\/h2>\n\n\n\n<p>\u5982\u679c\u662f\u6a2a\u5c4f\u6e38\u620f\uff0c\u76f4\u63a5\u5bfc\u51fa\u540e\u5728\u624b\u673a\u4e0a\u65e0\u6cd5\u9002\u914d\uff0c\u9700\u8981\u8fdb\u884c\u5c4f\u5e55\u9002\u914d<\/p>\n\n\n\n<div class=\"wp-block-file\"><a id=\"wp-block-file--media-d9934818-3444-4d47-a0a5-7e66fae38867\" href=\"http:\/\/blog.coolcoding.cn\/wp-content\/uploads\/2026\/04\/webgl_template.zip\">webgl_template<\/a><a href=\"http:\/\/blog.coolcoding.cn\/wp-content\/uploads\/2026\/04\/webgl_template.zip\" class=\"wp-block-file__button wp-element-button\" download aria-describedby=\"wp-block-file--media-d9934818-3444-4d47-a0a5-7e66fae38867\">\u4e0b\u8f7d<\/a><\/div>\n\n\n\n<p>\u5c06\u4ee5\u4e0a\u6a21\u677f\u5e93\u66ff\u6362\u6389\u5bfc\u51fa\u7684index.html, TemplateData\u6587\u4ef6\uff0c\u518d\u5c06\u6574\u4e2aweb\u76ee\u5f55\u90e8\u7f72\u5230\u81ea\u5df1\u7684x.com\u4e0a<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u8f93\u5165\u95ee\u9898<\/h2>\n\n\n\n<p>\u5728\u624b\u673a\u4e0a\u65e0\u6cd5\u8f93\u5165\uff0c\u9700\u8981\u5bfc\u5165WebGLInput\u63d2\u4ef6<\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/kou-yeung\/WebGLInput\">https:\/\/github.com\/kou-yeung\/WebGLInput<\/a><\/p>\n\n\n\n<p>\u5728InputField\u7ec4\u4ef6\u4e0a\uff0c\u6302\u8f7dWebGLSupport.WebGLInput\u7ec4\u4ef6<\/p>\n\n\n\n<p>\u6ce8\u610f WebGLSupport.WebGLInput\u6709\u5751\uff0c\u4ee3\u7801\u4e2dApplication.isMobilePlatform\u5728WebGL\u4e0a\u4e3afalse\uff0c\u9700\u8981\u5f3a\u884c\u5c06\u6240\u6709\u7684Application.isMobilePlatform\u76f4\u63a5\u4e3atrue\uff1b<\/p>\n\n\n\n<p>\u4ee5\u4e0b\u4e3a\u4fee\u6539\u540e\u7684\u7248\u672c<\/p>\n\n\n\n<div class=\"wp-block-file\"><a id=\"wp-block-file--media-4226a362-adf9-4483-9cb1-0c8bc0d2a2f1\" href=\"http:\/\/blog.coolcoding.cn\/wp-content\/uploads\/2026\/04\/WebGLSupport.zip\">WebGLSupport<\/a><a href=\"http:\/\/blog.coolcoding.cn\/wp-content\/uploads\/2026\/04\/WebGLSupport.zip\" class=\"wp-block-file__button wp-element-button\" download aria-describedby=\"wp-block-file--media-4226a362-adf9-4483-9cb1-0c8bc0d2a2f1\">\u4e0b\u8f7d<\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u5220\u9664\u4e0d\u652f\u6301\u7684\u7b2c3\u65b9\u63d2\u4ef6 \u4f8b\u5982\uff1a \u6253Assetbundle\u5305\uff08WebGL\u5e73\u53f0\uff09 \u6ce8\u610f\uff1a\u4e0b\u8f7d\u6587\u4ef6\u4f7f\u7528Applica [&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\/6355"}],"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=6355"}],"version-history":[{"count":16,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts\/6355\/revisions"}],"predecessor-version":[{"id":6375,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts\/6355\/revisions\/6375"}],"wp:attachment":[{"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6355"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6355"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6355"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}