Join Jesse Freeman for an in-depth discussion in this video Importing artwork, part of Unity 5 2D Essential Training (2015).
- Before we start building out our game, we're gonna have to create the new game project. Here I have Unity opened up, and you'll see in this window if we actually had projects we had worked on in the past, they would be listed out here under the projects tab. We're gonna create a new project, and we're gonna call this SuperZombieRunner. Our game is gonna be an endless runner. And these are very popular games, and they're also easy to make. In this course, we're gonna focus on the essentials of what makes an endless runner, such as our player, spawning objects, and trying to avoid them so that we don't die.
Once you've selected a location for where you wanna save your project, make sure you select the 2D mode so that Unity knows how to one, import artwork and to convert them automatically into sprites instead of textures for us; and two, it'll also fix the way that the camera view is so that we'll just see the 2D mode view. When you're ready, click Create Project, and Unity'll create this new project for us. Before we get into bringing in the artwork and the stuff we'll need for our game, I just wanted to take a moment to talk about configuring the layout of Unity.
By default, this is what you see. Now usually I like to have the Game tab below the Scene, I move the Hierarchy next to the Inspector, and I'll put the Project and Console together at the bottom. And also let me move the Inspector closer to Hierarchy so I now have this panel split between the Hierarchy, which will be everything inside of our game, the Inspector, which displays all the properties of any of the game objects in our scene that we select.
The Console is where we'll use for debugging to trace out issues and values that we see inside of our game, and Project is where all of our files are. Here in the Scene view, we'll be working with all the game objects and laying out our game. And in the game, we'll be able to preview what we're doing, and we'll also be able to see how the game is running when we hit the play button. When you're happy with a layout that you feel comfortable with, you can always go to the Layout tab and save that layout. Here I've already saved out my own layout for scene_game_stacked.
I'll rerun it, and you'll see it's similar to what we just laid out, except this is more in the middle. Before we move on, let's add the artwork that we'll need in our game. Here in the Assets folder, we can create other folders in order to better organize our files. Simply right click in the Assets folder and select Folder from the create menu. Here we'll call this Artwork. Now I've already created all the artwork we need for the game, and I've actually organized them in folders for us.
If we go into the Artwork folder that comes with the files, we can select the three folders of Artwork and drag them over into our project into the Artwork folder. You'll see here in Unity that we can now drop this down to see the files as well as select them and see the files here. If you'd like to see the items in list view, you can drag the slider here, and now all the folders will be listed out. This is convenient when you're going through and you have a lot of artwork that you need to go through or other files, such as scripts, and you want to see a lot of them and organize them a little bit better.
Next, we'll talk about how to work with the artwork in our game, and we'll explain what a sprite is and how to clean up the graphics so that they're ready to use inside of our Scene. Now we're ready to save our Scene. If you hit Command S, or go to File, Save, you'll be able to save the current scene we're working in. Let's make sure we save this inside of our Assets folder, and let's make a folder called Scenes. Now inside of Scenes, we're gonna call this GameStaging, and for the rest of the project, we'll be working inside of this scene.
Normally, your game can contain multiple scenes, so I like to keep them organized in their own folder. Let's hit Save, and you'll see that this shows up inside of our Asset folder. If for any reason when you relaunch the project, the default scene doesn't get loaded, you can simply go into the scenes folder and double click on it to reload that scene. It's also important to note that when you're done making any changes to a project, you should always save the scene before quitting. Now let's move on and take a look at how to work with sprites within our game.
Super Zombie Runner riffs off the popular endless runner genre: a one-button casual game that's not only fun to play but exciting to build. The focus of the work is a reusable code base that you can extend and make your own, while learning the basics of object pooling, supporting multiple screen resolutions, tracking scoring, and multi-platform publishing. Along the way, Jesse covers key Unity features, such as working with sprites, creating animations, and leveraging the UI components.
- Working with sprites and animation
- Creating the player
- Spawning GameObjects
- Adding obstacles and collisions
- Building the game objects and logic
- Managing game state
- Creating pixel-perfect cameras
- Designing for multiple screen resolutions
- Adding scores
- Optimizing performance
- Publishing to desktop, web, and mobile platforms