Check out a free preview of the full Unity for Web Developers course:
The "Introduction" Lesson is part of the full, Unity for Web Developers course featured in this preview video. Here's what you'd learn in this lesson:

Nick Pettit introduces the course by providing some personal background in game design and development. An overview of the course agenda and a demonstration of the completed Unity game are also provided in this segment.

Get Unlimited Access Now

Transcript from the "Introduction" Lesson

[00:00:00]
>> Well, hey everybody, I'm Nick Pettit, and today's workshop is introduction to Unity for web developers. In today's workshop, we're going to be creating a video game that we're going to deploy to the web using WebGL. And I'll get to the agenda for today in just a second, but first I wanted to talk a little bit about my journey and how I got into game development.

[00:00:30] I've been programming for about 20 years now. And I first got into it by just making websites, actually in front page, if anyone remembers what that is. And so I was making websites, learning about programming. I got into PHP and Ruby on Rails. And I was building websites for my friends and doing it on a contractual basis.

[00:00:57] And I started making web applications for myself and for a couple of different businesses I was running. And basically, I got into the education side of it. I was very passionate about sharing the knowledge that I had learned, and I wanted to give back to the community in the same way that I had received so much from the community.

[00:01:22] So I did get into teaching it at an online school called Treehouse, so I did that for about ten years. And then during that time, I started getting interested in VR and AR, and I kinda saw the trend that was happening there and it was just a very fascinating space to me.

[00:01:47] I wanted to just learn more about how to get into that and how to approach it. And at the time, it really was pretty difficult to do stuff with VR in a web environment, but with a game engine like Unity, it was very accessible, it was very democratized.

[00:02:10] And so I started getting into the Unity game engine and just teaching myself learning through YouTube videos. And of course, Unity's website has tons of great resources for learning how to create games with their engine. And at this point, I've been making games for about eight years, and now I make games for a living at a company called Buck.

[00:02:36] They're a global creative company that brings brand stories and experiences to life through art, design, and technology. So they do lots of high key advertisements, Super Bowl commercials, that kind of thing. And they wanted to create games, they wanted to get into original IP. So unfortunately, I can't really share a whole lot about what we've been up to, but I can show you some of the past projects that I've worked on.

[00:03:03] One in particular that I'm very proud of is called Neptune Flux, it's a deep sea adventure game. And that came out in, well, it came out in 2016 for Steam and I released it on the Vive and Rift. It was also playable without a VR headset. And then I also released it for PlayStation VR.

[00:03:28] And that was very exciting. I'd never made a console game before, I'd never worked on a triple A team or anything like that, I was just doing this all from my apartment. [LAUGH] And it was kind of not something I would recommend now. Looking back, that was a very big undertaking and certainly not something I regret, but I learned a lot from it.

[00:03:56] But I mean, yeah, I've been making games for about eight years and I have done all sorts of things. I executed on contracts for AR projects, I've made Sim and training demos. And we'll get into more of the applications of Unity in a just sec, but let's talk about what we're going to be doing today.

[00:04:21] So we are going to make a game. So at the end of this, we'll have a game that we can deploy to WebGL. We'll get started just by learning how to install Unity. You may have Unity installed already, but it's good to know just kind of the ins and outs of that, because it is somewhat of an involved installation process or it can be.

[00:04:45] And then we'll take a brief tour of the Unity interface just to kinda get familiar with all of its rearrangeable panels and windows. And then we'll learn about scenes, GameObjects, and components and how those all relate to one another. We'll use C# to make a physics sandbox, and then we'll add player input to that, so that we can actually interact with it and move around.

[00:05:10] And then we'll create what's called a game manager script. And so that will kind of be like the game loop, where all of the business logic happens. Then we'll add some UI to the game, so that all of those numbers that we're tracking in the game manager can actually be exposed to the player.

[00:05:33] And we'll add more complex behavior on top of that. So we'll start kind of layering more components that will drive some more emergent behavior. And then we'll make the game look better, because we're gonna start out with just kind of gray spheres and cubes. And then we'll add materials and lighting and post-processing on top of that to make things look better.

[00:05:59] And then we will deploy the game to a web browser using WebGL, and I think you'll find that is surprisingly easy to do in Unity. So first, I just wanna show you what we're actually going to be creating. So I'll jump here, and you can play this right now, it's at bit.ly/fm for frontendmasters-unity.

[00:06:28] So here's the Unity splash screen. And it says, collect more cubes than your opponent. Press SPACE to Start. So if I hit the spacebar, the game will start, and I can use the WASD keys or the arrow keys to move this gold sphere around and try to collect these little purple orbs.

[00:06:49] And you'll see that I have an opponent there, the blue sphere that is also rolling around. It's really using some very simple logic, but it actually has the appearance of having some amount of intelligence, where it's trying to collect these faster than I can. You'll see that there's UI up at the top, so it's keeping score of how many of these I've collected and how many the opponent has collected.

[00:07:18] And there's also a timer that starts at 60 seconds and ticks down as the game moves forward. And you'll see that there's other nice little features, like if I roll off the side here, it will actually respawn. And when the timer runs out, there'll be a game over screen.

[00:07:38] And I lost. if I had collected more, I would have won, and of course, if it was a tie, it would say it's a tie. And then you can hit the spacebar to start again, and then it'll reset the clock and reset the scores. And there's other cool things that we can do with this.

[00:07:55] We can adjust the speeds that you see here to potentially make it a little easier or even more difficult. But yeah, so this is what we're going to be building today.