Game Development with Unity for Web Developers Scenes, GameObjects & Components
Transcript from the "Scenes, GameObjects & Components" Lesson
>> There's a relationship between all of these things. Scenes, are the container for everything that is in your game. Game Objects are the most fundamental building block of your game and then components, drive the behavior of those game objects. So let's break that down a little bit more.
[00:00:20] So scenes, are actually assets, their files with the .unity extension and they can contain all or part of your games content. And I say that because, multiple scenes can be loaded at a time to help split up that content. So, for example, if you're building an open world game, you might have a bunch of chunks that need to be loaded in, because there's a limited amount of memory on the platform that you're deploying to.
[00:00:51] So, you could stream in those assets, as the player is moving around the world. That's one example of how scenes might be used. Scenes could also be used, by using them just as a construct for levels in your game, right? So, a lot of games have levels, where you progress from one level to the next and scenes might be a good way for you to break that up, or you might have a scene that is your main menu and then you might have another scene that is the the actual gameplay, that you transition between.
[00:01:29] So, lots of different ways that those can be used. Game objects, which is maybe the most important thing in Unity, are the building blocks for scenes in Unity and they are really just a container for components, game objects are almost nothing really [LAUGH]. And yet they're everything. So, they really are just a container for components.
[00:01:55] Game objects, will always have a transform component attached to them by default. So, you can't have a game object in Unity without a transform. And, I'll show you what that looks like in a moment. But a transform component, will have a position rotation and scale and that is what places a game object, in the 3D world.
[00:02:18] So that places it within the context of the scene, within the 3D space. Components, are scripts that you can attach to game objects to change their behavior. So, Unity leans toward a component based architecture, which we'll get into later. But scripts, that when they are attached to a game object, define the behavior of that game object, and components are created via C sharp scripts and, they can expose values that are modified in the inspector.
[00:02:56] So, you saw in the inspector that I had a bunch of values when I was selecting different game objects in the hierarchy and those are values that can be modified.
>> What IDE do you use or recommend with Unity?
>> So, I personally use Visual Studio, but VS Code is also great for Unity, and a lot of developers use it.
[00:03:24] So, yeah, VS Code or Visual Studio, whichever you prefer.
>> And is Unity cross-platform across like Mac, Linux and windows?
>> Yes, so Unity is available on Windows, Mac, and Linux right now, as the editor. The platforms that you can deploy your game to are much broader. So, you can of course deploy to Windows, Mac, Linux, but gosh, the deployment is much wider, there's, I don't know what the number is, but it's probably like 100 different platforms that you can deploy to.
[00:04:02] So AR, VR consoles, mobile, you name it, you can probably get a Unity game running on it.
>> You'll probably get into this later in the course, but there was somebody asking how that WebGL deployment process works.
>> We will get into it and I think you'll be surprised by how easy it is.
>> Is it WebAssembly or-
>> Yes, under the hood, it is WebAssembly. All right, are there any additional questions? Okay, cool. Well, like I said, Unity games are composed of scenes, so scenes contain game objects and those game objects, have components attached to them that drive their behavior