Our First Game / Skyboxes
Subtitles of the Movie
In this part, we'll take a look at how to add a sky and skies in Unity are called Skyboxes. Now, in my scene here, I have deleted the terrain and the trees and all that because it slows down capturing a little bit. But, for yourself, don't feel obligated to do the same because skies look beautiful when applied when there's a terrain active in the scene. Now, to add a skybox, there's a couple of way to do this. But first, let's use the most effective way. Go to our Main Camera and select it. Now, in the camera, you can see there's a couple of things already. There's a GUI Layer, a Flare Layer and Mouse Look Script and some other things. But in this camera setting's themselves, you could see a setting called Clear Flags and this is set to Skybox. Now, there is no skybox in our scene yet and what Clear Flags basically does is, these are all the things that are rendered when there's no geometry. So, for example, when we look at our game view from this camera, you can see that there's nothing in the sky. So, basically, the background color that is set here is picked. If I were to change this background color, you could see it changes immediately in the game, as well. However, our Clear Flags are set to render Skybox but currently, there is no skybox component attached to this camera. To add a skybox, simply go to Component and then Rendering and then Skybox. Now, this will say we will lose a prefab connection with the first person controller because, remember, we dragged the first person controller as a prefab into the scene. However, that's OK. We don't need that connection there. So, just click Add and now you can see there's a skybox down here. But, the flags are not set yet to what skybox we want. So, we can drop down here and there's 2 skyboxes; Blue Sky and Sunset. Let's click Blue Sky and as you can see now, there's a skybox in the world. Let's play the game for a second. Now, let me show you exactly how it works. The skybox consists of 6 images, because it's the same thing as a box or a cube. There's one for the front, for the right, for the back, for the left, there's one for up and there's one for down. Now, the down one right now is pretty hard to see, but, as you can see, it's probably black. Of course, we could select a different skybox if we wanted to. Instead of the Blue Sky, let's try Sunset. Then hit Play. As you can see, the same thing is now happening, except that we don't really want to see this black spot on the bottom. That's why most terrains or in most games, the terrain actually blocks out the view so that you cannot see the bottom. Now, there's also another way to add a Skybox to the scene and that is to go to Edit and then Render Settings. In our Reader Settings, we can also select a Skybox and that is set with a Skybox Material right here and the difference between doing this and doing it exactly on a camera, is because the Render Settings are applied to all the cameras in the scene. So, if you want all the cameras to have the same skybox, then set your skybox here. If you want every camera to be slightly different or to see a different skybox, then do it on your camera or all the other cameras you have in your scene. And that's basically how Skyboxes work.
Tutorial Information
| Course: | Introduction to Game Development Using Unity 3D |
| Author: | Efraim Meulenberg |
| SKU: | 34092 |
| ISBN: | 1-936334-03-8 |
| Release Date: | 2010-02-23 |
| Duration: | 5.5 hrs / 75 lessons |
| Work Files: |
Yes |
| Captions: | Available on CD and Online University |
| Compatibility: |
Vista/XP/2000, OS X, Linux QuickTime 7, Flash 8 |
VTC Sign up & Benefits
- Unlimited Access
- 98,729 Video Tutorials (23,265 free)
- Video Available as Flash or QuickTime
- Over 1026 Courses
- $30 for One Month Access
- Multi-User Discounts Available
United States 