Check out a free preview of the full Game Development with Unity for Web Developers course

The "Wrapping Up" Lesson is part of the full, Game Development with Unity for Web Developers course featured in this preview video. Here's what you'd learn in this lesson:

Nick wraps up the course by discussing some key ideas to take away from the course. Students' questions regarding toolsets to offload asset storage, if a home screen would be a new scene or a UI view, if it's possible to access game objects with JavaScript, if the game can be prevented from restarting while running, and if the UI can be reset for varying screen size are also covered in this segment.


Transcript from the "Wrapping Up" Lesson

>> And so now we made a video game. There's a couple of things that I want you to keep in mind and take away from this. Unity, first of all, is great for making games. But it can also be used for so many other things in so many other verticals.

Unity can be used for simulations and product demos. It can be used in lots of AR and VR applications. And Unity really is just finding its way into more and more surprising places. The really cool thing about Unity is that you can deploy your projects to a wide variety of platforms.

I mean, you saw how easily it was to deploy to WebGL. Unity allows you to write your code once, and then you can pretty easily port it to other places. You do have to do platform specific integrations, say for achievements on different consoles or steam or something like that.

But it's pretty easy to take the same game and make it fit into different places. I want you to remember to think in terms of Unity's component based architecture and try to favor composition over other approaches to code diversification such as inheritance. So you wanna put components together to get that emergent behavior and have them interact with one another.

That's kinda how you wanna try to think about Unity architecture as much as you can. Another really great thing about Unity is that you can leverage the community, the asset store, the documentation. And in my opinion, this really is the true advantage of Unity over other game engines, Unity is incredibly robust and feature full and powerful.

But really it's community and the asset store and all of its great documentation that I think in my own personal opinion, gives it a slight edge. And then the last thing I want you to remember is that game development is a huge and very interdisciplinary topic. And just Unity on its own, even within the context of game development, is still a huge application and a huge ecosystem.

So what we saw today was kind of a golden path to creating a very simple game, but as you can imagine, there's so much more to learn and explore. Like we didn't add any kind of like particle effects. There was no multiplayer. We didn't add sound to the game.

I mean, there's so many other things that you can do with Unity, and so many other systems that we we can touch. But yeah, I encourage you to learn and explore as much as you can. So are there any questions from anyone here or anyone in the chat who made a video game?

>> I had a question specifically in the context of the web when you have a project that grows, that becomes very large. Does Unity have any tool sets to kind of offload where the assets get stored? Are there some other location?
>> Yeah, very much. So there's a number of different tools for that.

I mean, one is just called asset bundles. I mean asset bundles are used to kind of like split up just the different stuff in the game so that it's not one giant file attached to your exit executable file. So, I mean, that's one thing, just to split it up on disk.

But yeah, absolutely, you can stream assets from any source that you want to, and in fact, that's a really powerful way to also design games. A lot of games will connect up their stats to even just like a Google sheet. And you can import values for, say different items in your game using just a spreadsheet and kinda going through the numbers.

So, there's lots of different ways that other things can connect into Unity. And yeah, you can certainly stream assets from a server. It's more complicated, but certainly something that happens often. Yeah.
>> Regarding scenes, let's say if we wanted to add a home menu before you load into the game, would that be something you would do with a canvas that makes the camera look at a UI?

Or make an entire separate scene and have the game menu unconnected?
>> Both approaches are valid. In a game this simple, I would just create a new full screen canvas that is shown and gets hidden. But in more complicated games, if you have a game with say, multiple levels, or you're streaming in an open world in chunks.

And you have a lot more code to manage those scenes, then, yeah, absolutely, you could put menus in different scenes. There's really no right or wrong answer there. It really just, it's kind of project dependent.
>> Is it possible to access some of these game objects with JavaScript?

>> Possible probably. How you would do that? I don't know. But I mean, Unity is such [LAUGH] a big ecosystem of stuff. I'm sure somebody has done that somewhere at some point. [LAUGH] No, I've never tried that myself.
>> Should we prevent their game from restarting during running?

Like, if you hit Space during the game and it restarts?
>> Probably, I'm curious, is that what's happening right now? Cuz I think that is prevented, but let's see. So if I hit Space, yeah, that will just reset the position of the player. So, yeah, that would probably be a good thing to improve.

[LAUGH] I mean right now it just resets the position of the player and resets the scores. But yeah, let's try that right now. Let's do a little bit of live coding, which is always risky. So let's see. So, if the game's not playing, we just return, right? So what we would need to do is actually make that like a static property.

So we could have a public static Boolean, we say GameIsPlaying. And we will set that to this value, which is also going to need to become static. So let's just try that. So where are we resetting that? Let's see at the Collectible. So under reset position we'll say GameManager.GameIsPlaying.

And so if the game is not playing, And this may or may not work. We are trying this out. So if the game is not playing, don't reset the position of the collectible. Same thing here for the players. And then I think we need to do that in score as well.

So let's try that out. Okay, and then yeah, we don't wanna reset the score. So if GameManager.GameIsPlaying, It's not playing, right? Yeah, not playing. Let's see if that worked. I don't know if this will. So now if we play, Hit Space to start. If I hit the spacebar, nothing is happening and we'll just run out the game clock more quickly here.

So if we set that to 5 seconds, I hit Space and the game stops. We should be able to, now just continues, it doesn't reset it. So didn't quite work, but yeah, that was a good catch cuz that is definitely a bug in a production game. It should be addressed for sure.

There are other questions?
>> Just the titles, when the screen sizes are changing, can you have them so that proportionally you can stay?
>> Are you talking about the UI?
>> Yeah, just the UI stuff. Yeah, just because we have it changing on different resolutions, right?
>> Yeah, I mean, if we change-

>> That means all these symbol are there, right?
>> Yeah, I mean If you change the resolution of the game, it should, yeah, reset the UI. I mean, that's part of the power of the UI system is that we had those anchor points and we're kind of setting where we want those to be on screen.

And we're also auto sizing the text between that min and max that we set.
>> I just saw it when compiled, I think there resolutions got pretty way off.
>> Yeah, I think that has to do with the capture resolution. Although, I'm not entirely sure if that's the case.

Yeah, if I hit this 4K, yeah-
>> They're gonna get to resize that.
>> They're gonna get to really tiny. There should be a way, if we go to the canvas let's see, we can change the canvas to Scale with Screen Size. So that's probably a little bit better.

And if we resize that, what would that look like? Yeah, that'll keep it pretty large. So yeah, I mean, that could be a potential way to mitigate that if you change the canvas scale or to scale with screen size. So yeah, so also a good improvement there. Well, that's it.

That's all I got. Thanks for listening.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now