
Export your first WebGL game by setting up Unity Hub with a year-numbered version, importing an asset, configuring WebGL 2.0 and color space, then building and running in a browser.
How to build and deploy a game to the web using Unity. We also cover running a local server, and using ngrok to test on external computers.
Review the first lecture, a first assignment, and where to find Unity games to download and build on the web.
Use the browser's developer tools console to identify WebGL export errors and search for fixes, starting with messages like no access control allow origin header for debugging Unity WebGL builds.
Learn the roadmap for building and deploying WebGL games with Unity, covering responsive design, player settings, deployment options, WebGL templates, and browser scripting interactions.
Trace the history of Unity on the web from the 2005 Mac OS X plugin to modern WebGL and Webassembly, with browser adoption by 2013 and Unity 5.0's 2015 debut.
WebGL is a web standard backed by the Khronos Group, open across browsers, enabling fast, native-like browser games with WebAssembly and Unity, delivering directly without app store friction.
We weigh the drawbacks of using Unity for browser games, including closed source licensing, poor WebGL debugging with no source maps, and weak mobile support, alongside its heavyweight size.
Learn to create a responsive template that keeps the game fitting the window as it resizes, implement a Google font, and enable data caching to speed load times.
Learn to make your Unity WebGL game responsive by using minimal and responsive templates, adjusting WebGL settings, and importing a responsive WebGL template so the game fills the browser window.
Fix squished text in Unity WebGL by importing your own open source fonts, like Mukta from Google Fonts, and anchor UI text to the top center.
Learn to configure WebGL player settings in Unity for browser exports, including default canvas size, templates, and splash options. Optimize graphics API, color space, memory, and data caching.
Explore hosting and deployment options for web games, from SiteGround and GitHub Pages to Firebase and AWS, comparing pricing, storage, bandwidth, and embed capabilities.
Deploy a browser game with SiteGround hosting, choose a plan, set up domain DNS and privacy, and create an index.html in cPanel to test during propagation.
Deploy a Unity WebGL game using GitHub pages by creating a public repository, enabling GitHub pages from the master branch, uploading WebGL export files, and hosting the index.html.
Explore deploying a WebGL game to AWS using Amazon Web Services, noting AWS powers about 33% of the cloud market and articles with a short link for deployment guidance.
Learn how to post your WebGL Unity game to Medium and WordPress by embedding via URL or iframe, previewing, and adjusting height to reduce letterboxing for a clean blog display.
Customize WebGL templates beyond the default options to better fit your game's presentation. Explore exporting a WebGL build and using the minimal template to craft ambient context.
Copy the minimal WebGL template, create a custom template in WebGL templates, edit it in a text editor, and build a WebGL custom game that shows this is my template.
Explore WebGL templates with percent-sign placeholders in the index.html that Unity fills from player settings, and backport template edits for faster builds and testing.
Add a forest background to a browser game by importing a royalty-free image from Pixabay, placing it in an images folder, and applying inline CSS that scales with the window.
Apply a border to the game container in a Unity WebGL project using JavaScript after runtime initialization, with CSS transitions and camelcase properties including border radius.
Move inline styles to a styles.css in a css folder, link it in the header, fix image paths with ../, and use ids like #title and #game-container for readability.
Backport changes to Unity by porting the percent placeholders from the original index.html into the WebGL template, then update the loader URL, build URL, and width and height.
Explore integrating a responsive WebGL template with Unity, including handling the index.html setup, importing the template, and implementing a set dimensions function to resize the canvas on window resize.
Create a custom WebGL template or upload another game to Simmer, then share it via GitHub, Firebase, or WordPress, and donate $10 for each of the first 50 reviews.
Download the GitHub image demo, unzip and open it in Unity using Unity Hub, then run the sample scene to test image loading and understand how to import the image.
Create a Unity WebGL project and download an image from the web to display in a UI image using the WWW class and an asynchronous coroutine, noting a cors issue.
Inspect web requests and headers using httpie, compare it with curl, and learn how to install httpie on macOS or Windows via brew or pip.
Use httpie to inspect web requests and confirm cors for images in a unity browser game. Note access-control-allow-origin: *, compare imager and personal site URLs, and apply a short-term workaround.
Discover how to beat cors errors by using Cloudinary as a proxy to load images in Unity WebGL, transforming images, and managing assets with a generous free plan.
Test Cloudinary integration in a Unity WebGL build to verify image loading and avoid cors errors, then implement a static Cloudinary class with a get url function for dynamic images.
Create an image search tool in Unity using json and web APIs to fetch royalty-free images from Pixabay, parse json, and load image URLs as textures in WebGL.
Explore json, javascript object notation, and its use for key value pairs, arrays, and nested objects, demonstrated with a movie object including title, year, stars, and budget.
Wire up the user interface by exposing public fields, wiring the search button to onClick, and starting a coroutine to fetch JSON from Pixabay using the search field text.
Learn to fetch the top image result from Json data using mini Json in Unity, extract the large image URL from the hits array, and draw it on a canvas.
Parse json in unity using mini json, deserialize to a dictionary, and safely read the hits array and the first hit's large image url.
Load the image from Pixabay into a Unity WebGL sprite, set native size for full-screen display, and load via a coroutine using the large image URL.
Visit rocket slash search Pixabay on GitHub to fetch Pixabay API data with Unity web request, parse with mini Json dot CSS, and load the first image into a texture.
Learn bidirectional WebGL integration with browser scripting by connecting a Flappy Bird game to the web page, sending flap commands from the browser and surfacing game events to JavaScript.
Unity project for browser scripting, import the Flappy Bird example, enable 2D mode, build and run with WebGL, and duplicate index.html to editable index.html to preserve edits.
Modify the WebGL Unity project to fade the page background red when the bird dies and back to white on respawn, via a JS lib function and runtime WebGL check.
Prepare the Unity web build for javascript calls by creating an editable index.html, js/oninit.js, and images and js folders, then add a flap button with flappy.png and enable cursor pointer.
Explore how Unity uses WebGL to communicate with the browser via scripting, passing strings, pointers, and JSON between Unity and JavaScript, and control from the web page.
Publish Unity WebGL games online using simmer.io and ngrok. Learn Unity’s web history, three secrets to shine—responsiveness, fonts, caching—and deploy via GitHub, Firebase, AWS, or Patreon.
Explore chrome developer tools with a beginner-to-expert path, learn to inspect and tweak web pages, and discover related Udemy resources for web development.
Fellow code warriors, if you've ever considered building 2D or 3D games for the browser, you won't find a better guide than Rocco's just completed course on Udemy. Rocco is a gifted instructor and keeps the information flowing at the right pace while maintaining a very practical emphasis.
AND he very thoughtfully avoids confusing users by wearing the same red plaid shirt for every lecture. Check it out!
- Michael Sample, Director of Engineering @Gliffy
Are you a game developer looking for the ultimate low-friction way to reach a wider audience on the web?
Or are you a web developer looking for a mature development environment for bringing 2D and 3D graphical web applications to life?
Within the first ten minutes of this course, you will be able to build a 3D app and deploy it to a live website. Then you'll learn the rich history of Unity and the web, and understand how to deploy browser games to various services including:
Github Pages
Google Cloud / Firebase
AWS
Kickstarter, Patreon, Wordpress and Medium and more...
Early in the course, you'll learn three secrets that will instantly make your game look fantastic in the browser. Then you'll do a deep dive about how to use images and textures pulled from the web. You'll learn how to interface with a web search API using CORS and JSON, and we'll cover how to avoid common errors when exporting your game to WebGL. Finally, you'll learn how to achieve bi-directional communication between the browser and Unity.
This course is NOT a general purpose Unity tutorial, nor is it a general purpose Web development class. There are plenty of those. This IS an intermediate-level topics course that will spark your imagination with the amazing possibilities of 2D and 3D graphical applications in the browser.
While the earlier lessons don't require much coding, we will use plenty of C#, Javascript, HTML and CSS in the later lessons. You'll get the most out of this course if you have some development experience with either Unity or the web. But don't worry, we'll go over all the code line-by-line, and I'll share various resources and documentation with you that will help you create awesome browser-based 2D and 3D apps!
From the instructor:
I have almost twenty years of professional development experience. In the first half of my career I was a professional game developer (Rock Band, The Sims, and many more), and in the second half I specialized in graphical applications for the web (Gliffy diagramming and SIMMER game hosting).
I've tried various web-graphics libraries like three.js, babylon.js, phaser and playcanvas. Nothing comes close to the mature development tools contained within Unity3D. I believe we are at the dawn of a new era of rich 2D and 3D experiences on the web, and Unity is the killer app that will make it happen.