{"id":2733,"date":"2021-04-25T17:23:40","date_gmt":"2021-04-25T22:23:40","guid":{"rendered":"http:\/\/www.courses.art.cmu.edu\/2021s\/60210a\/?page_id=2733"},"modified":"2021-04-25T18:11:14","modified_gmt":"2021-04-25T23:11:14","slug":"unity-building-to-webgl","status":"publish","type":"page","link":"http:\/\/www.courses.art.cmu.edu\/2021s\/60210a\/daily-notes\/04-26-unity\/unity-building-to-webgl\/","title":{"rendered":"Unity: Building to WebGL"},"content":{"rendered":"<h2>Setup<\/h2>\n<p>Install WebGL module through Unity Hub if you haven&#8217;t already. To start, in Unity, go to Menu -&gt; File -&gt; Build Settings. You will see the below popup &#8211;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-2734\" src=\"http:\/\/www.courses.art.cmu.edu\/2021s\/60210a\/wp-content\/uploads\/2021\/04\/Screen-Shot-2021-04-25-at-5.57.36-PM-484x480.png\" alt=\"\" width=\"390\" height=\"387\" srcset=\"http:\/\/www.courses.art.cmu.edu\/2021s\/60210a\/wp-content\/uploads\/2021\/04\/Screen-Shot-2021-04-25-at-5.57.36-PM-484x480.png 484w, http:\/\/www.courses.art.cmu.edu\/2021s\/60210a\/wp-content\/uploads\/2021\/04\/Screen-Shot-2021-04-25-at-5.57.36-PM-1024x1016.png 1024w, http:\/\/www.courses.art.cmu.edu\/2021s\/60210a\/wp-content\/uploads\/2021\/04\/Screen-Shot-2021-04-25-at-5.57.36-PM-150x150.png 150w, http:\/\/www.courses.art.cmu.edu\/2021s\/60210a\/wp-content\/uploads\/2021\/04\/Screen-Shot-2021-04-25-at-5.57.36-PM-768x762.png 768w, http:\/\/www.courses.art.cmu.edu\/2021s\/60210a\/wp-content\/uploads\/2021\/04\/Screen-Shot-2021-04-25-at-5.57.36-PM-1200x1191.png 1200w, http:\/\/www.courses.art.cmu.edu\/2021s\/60210a\/wp-content\/uploads\/2021\/04\/Screen-Shot-2021-04-25-at-5.57.36-PM.png 1268w\" sizes=\"auto, (max-width: 390px) 85vw, 390px\" \/><\/p>\n<p>IF you see &#8220;No WebGL module loaded&#8221;, click on the &#8220;Install with Unity Hub&#8221; button. Otherwise, skip this section.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-2736\" src=\"http:\/\/www.courses.art.cmu.edu\/2021s\/60210a\/wp-content\/uploads\/2021\/04\/Screen-Shot-2021-04-25-at-5.58.12-PM.png\" alt=\"\" width=\"347\" height=\"128\" \/><\/p>\n<p>It should open Unity Hub with this view. Just click done and wait for it to install. Once it&#8217;s open, restart Unity and reopen your project.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-2735\" src=\"http:\/\/www.courses.art.cmu.edu\/2021s\/60210a\/wp-content\/uploads\/2021\/04\/Screen-Shot-2021-04-25-at-5.58.19-PM-640x438.png\" alt=\"\" width=\"500\" height=\"342\" srcset=\"http:\/\/www.courses.art.cmu.edu\/2021s\/60210a\/wp-content\/uploads\/2021\/04\/Screen-Shot-2021-04-25-at-5.58.19-PM-640x438.png 640w, http:\/\/www.courses.art.cmu.edu\/2021s\/60210a\/wp-content\/uploads\/2021\/04\/Screen-Shot-2021-04-25-at-5.58.19-PM-1024x701.png 1024w, http:\/\/www.courses.art.cmu.edu\/2021s\/60210a\/wp-content\/uploads\/2021\/04\/Screen-Shot-2021-04-25-at-5.58.19-PM-768x526.png 768w, http:\/\/www.courses.art.cmu.edu\/2021s\/60210a\/wp-content\/uploads\/2021\/04\/Screen-Shot-2021-04-25-at-5.58.19-PM-1200x822.png 1200w, http:\/\/www.courses.art.cmu.edu\/2021s\/60210a\/wp-content\/uploads\/2021\/04\/Screen-Shot-2021-04-25-at-5.58.19-PM.png 1498w\" sizes=\"auto, (max-width: 500px) 85vw, 500px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h2>Switch platform<\/h2>\n<p>Now, when you open Build Settings, you should see this instead.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2737\" src=\"http:\/\/www.courses.art.cmu.edu\/2021s\/60210a\/wp-content\/uploads\/2021\/04\/Screen-Shot-2021-04-25-at-6.03.51-PM-487x480.png\" alt=\"\" width=\"487\" height=\"480\" srcset=\"http:\/\/www.courses.art.cmu.edu\/2021s\/60210a\/wp-content\/uploads\/2021\/04\/Screen-Shot-2021-04-25-at-6.03.51-PM-487x480.png 487w, http:\/\/www.courses.art.cmu.edu\/2021s\/60210a\/wp-content\/uploads\/2021\/04\/Screen-Shot-2021-04-25-at-6.03.51-PM-1024x1009.png 1024w, http:\/\/www.courses.art.cmu.edu\/2021s\/60210a\/wp-content\/uploads\/2021\/04\/Screen-Shot-2021-04-25-at-6.03.51-PM-768x757.png 768w, http:\/\/www.courses.art.cmu.edu\/2021s\/60210a\/wp-content\/uploads\/2021\/04\/Screen-Shot-2021-04-25-at-6.03.51-PM-1200x1183.png 1200w, http:\/\/www.courses.art.cmu.edu\/2021s\/60210a\/wp-content\/uploads\/2021\/04\/Screen-Shot-2021-04-25-at-6.03.51-PM.png 1238w\" sizes=\"auto, (max-width: 487px) 85vw, 487px\" \/><\/p>\n<p>Select the &#8220;Switch Platform button&#8221;. It will start converting assets and this might take a minute or two.<\/p>\n<h2>Build!<\/h2>\n<p>Once it&#8217;s done, when you look at Build Settings, you should see this instead:<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2738\" src=\"http:\/\/www.courses.art.cmu.edu\/2021s\/60210a\/wp-content\/uploads\/2021\/04\/Screen-Shot-2021-04-25-at-6.05.34-PM-482x480.png\" alt=\"\" width=\"482\" height=\"480\" srcset=\"http:\/\/www.courses.art.cmu.edu\/2021s\/60210a\/wp-content\/uploads\/2021\/04\/Screen-Shot-2021-04-25-at-6.05.34-PM-482x480.png 482w, http:\/\/www.courses.art.cmu.edu\/2021s\/60210a\/wp-content\/uploads\/2021\/04\/Screen-Shot-2021-04-25-at-6.05.34-PM-1024x1019.png 1024w, http:\/\/www.courses.art.cmu.edu\/2021s\/60210a\/wp-content\/uploads\/2021\/04\/Screen-Shot-2021-04-25-at-6.05.34-PM-150x150.png 150w, http:\/\/www.courses.art.cmu.edu\/2021s\/60210a\/wp-content\/uploads\/2021\/04\/Screen-Shot-2021-04-25-at-6.05.34-PM-768x764.png 768w, http:\/\/www.courses.art.cmu.edu\/2021s\/60210a\/wp-content\/uploads\/2021\/04\/Screen-Shot-2021-04-25-at-6.05.34-PM-1200x1194.png 1200w, http:\/\/www.courses.art.cmu.edu\/2021s\/60210a\/wp-content\/uploads\/2021\/04\/Screen-Shot-2021-04-25-at-6.05.34-PM.png 1252w\" sizes=\"auto, (max-width: 482px) 85vw, 482px\" \/><\/p>\n<p>Hit the build button! It will ask you where you want to save it. Once you confirm, it will start building your project. This process usually takes a few minutes. When it&#8217;s done, locate the folder that it built the files to. For example, I named my folder Build, and here it is. Zip the folder so that it&#8217;s PROJECTNAME.zip.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2740\" src=\"http:\/\/www.courses.art.cmu.edu\/2021s\/60210a\/wp-content\/uploads\/2021\/04\/Screen-Shot-2021-04-25-at-6.11.31-PM-640x358.png\" alt=\"\" width=\"640\" height=\"358\" srcset=\"http:\/\/www.courses.art.cmu.edu\/2021s\/60210a\/wp-content\/uploads\/2021\/04\/Screen-Shot-2021-04-25-at-6.11.31-PM-640x358.png 640w, http:\/\/www.courses.art.cmu.edu\/2021s\/60210a\/wp-content\/uploads\/2021\/04\/Screen-Shot-2021-04-25-at-6.11.31-PM-1024x574.png 1024w, http:\/\/www.courses.art.cmu.edu\/2021s\/60210a\/wp-content\/uploads\/2021\/04\/Screen-Shot-2021-04-25-at-6.11.31-PM-768x430.png 768w, http:\/\/www.courses.art.cmu.edu\/2021s\/60210a\/wp-content\/uploads\/2021\/04\/Screen-Shot-2021-04-25-at-6.11.31-PM-1536x860.png 1536w, http:\/\/www.courses.art.cmu.edu\/2021s\/60210a\/wp-content\/uploads\/2021\/04\/Screen-Shot-2021-04-25-at-6.11.31-PM-1200x672.png 1200w, http:\/\/www.courses.art.cmu.edu\/2021s\/60210a\/wp-content\/uploads\/2021\/04\/Screen-Shot-2021-04-25-at-6.11.31-PM.png 1546w\" sizes=\"auto, (max-width: 640px) 85vw, 640px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h2>Upload to itch.io<\/h2>\n<p>Now we&#8217;re going to upload to itch.io, which you should already have an account for.<\/p>\n<ol>\n<li>Make a new project<\/li>\n<li>Select HTML for Kind of project<\/li>\n<li>For embed options, you probably want &#8220;click to launch in fullscreen&#8221;<\/li>\n<li>Upload your zipped file where it says upload! Make sure to select &#8220;this file will be played in the browser&#8221;<\/li>\n<li>And that&#8217;s it!<\/li>\n<\/ol>\n<p>If you want to know what it should look like, you can <a href=\"https:\/\/crabbage.itch.io\/test-unity-webgl-build?secret=CKgymXgrHDkbWLFBeOQTGqh5Yrg\">check out my test project on itch<\/a>.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Setup Install WebGL module through Unity Hub if you haven&#8217;t already. To start, in Unity, go to Menu -&gt; File -&gt; Build Settings. You will see the below popup &#8211; IF you see &#8220;No WebGL module loaded&#8221;, click on the &#8220;Install with Unity Hub&#8221; button. Otherwise, skip this section. It should open Unity Hub with &hellip; <a href=\"http:\/\/www.courses.art.cmu.edu\/2021s\/60210a\/daily-notes\/04-26-unity\/unity-building-to-webgl\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Unity: Building to WebGL&#8221;<\/span><\/a><\/p>\n","protected":false},"author":13,"featured_media":0,"parent":2770,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-2733","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"http:\/\/www.courses.art.cmu.edu\/2021s\/60210a\/wp-json\/wp\/v2\/pages\/2733","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.courses.art.cmu.edu\/2021s\/60210a\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/www.courses.art.cmu.edu\/2021s\/60210a\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/www.courses.art.cmu.edu\/2021s\/60210a\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"http:\/\/www.courses.art.cmu.edu\/2021s\/60210a\/wp-json\/wp\/v2\/comments?post=2733"}],"version-history":[{"count":3,"href":"http:\/\/www.courses.art.cmu.edu\/2021s\/60210a\/wp-json\/wp\/v2\/pages\/2733\/revisions"}],"predecessor-version":[{"id":2754,"href":"http:\/\/www.courses.art.cmu.edu\/2021s\/60210a\/wp-json\/wp\/v2\/pages\/2733\/revisions\/2754"}],"up":[{"embeddable":true,"href":"http:\/\/www.courses.art.cmu.edu\/2021s\/60210a\/wp-json\/wp\/v2\/pages\/2770"}],"wp:attachment":[{"href":"http:\/\/www.courses.art.cmu.edu\/2021s\/60210a\/wp-json\/wp\/v2\/media?parent=2733"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}