
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.
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.
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.
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.
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.
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.
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.
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 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.
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.
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.