Reader small image

You're reading from  Getting Started with Unity 5

Product typeBook
Published inMay 2015
Publisher
ISBN-139781784398316
Edition1st Edition
Tools
Right arrow
Author (1)
Dr. Edward Lavieri
Dr. Edward Lavieri
author image
Dr. Edward Lavieri

Dr. Edward Lavieri is a veteran software engineer and developer with a strong academic background. He earned a Doctorate of Computer Science from Colorado Technical University, an MS in Management Information Systems (Bowie State University), an MS in Education (Capella University), and an MS in Operations Management (University of Arkansas). He has been creating and teaching computer science courses since 2002. Edward retired from the U.S. Navy as a Command Master Chief after 25 years of active service. He is the founder and creative director of three19, a software design and development studio. Edward has authored more than a dozen technology books, including several on Java.
Read more about Dr. Edward Lavieri

Right arrow

Chapter 3. Working with Assets

In the last chapter, we designed our game and created our game environment, the virtual world that our players will interact with during the game. Now, we are ready to start populating our game environment with more than just trees and water.

In this chapter, we will take a close look at importing Unity and third-party assets from Unity's Asset Store directly into our game. These assets will be used to make our game environment more enjoyable for users. We'll add our pig, piglet, baby chick, adult chicken, old farmer, and Colt, our young farmer. These are our game's characters.

We'll import barns for the two farmers. We'll also create our own 3D asset using free software and import it into our game.

After reading this chapter, you will:

  • Understand what a Unity asset is

  • Be able to import a Unity asset into your game

  • Be able to import a third-party asset into your game

  • Understand Unity packages

  • Be able to import a Unity package into your game

  • Be able to use Blender to...

Assets


Assets are defined as useful or valuable things. In Unity, assets are useable game objects. There are three basic types of assets: Unity, user-created, and third party. As the names suggest, they are based on how the asset is created. Unity comes with free assets and offers a library of premium (not free) assets. User-created assets are those that you create yourself. We will create our own assets later in this chapter. The final asset type is third party, which indicates that someone other than you or Unity created it.

When we select the Assets drop-down menu, we see several functions available to us. The functions we'll cover in this chapter are Create, Import New Asset…, and Import Package, as shown in the following screenshot:

Navigating to Assets | Create reveals several types of assets we can create directly from within Unity. You'll notice that assets can be scripts, shaders, prefabs, materials, animations, and more. Assets are essentially any item we use in our game. We'll use...

Asset packages


In the last chapter, we imported an asset package so that we could create and modify our game's terrain. In this section, we'll look at what these packages are and how we'll use them in Unity and for our game.

Asset packages are bundles of assets grouped together. We can create packages to share our assets with others or to save them for use in another game or Unity application. We can even create asset bundles to sell in Unity's Asset Store.

To create an asset package, you simply select all the assets you want in the package, using the Project view. Then you have two options. Your first option is to right-click and select Export Package. The second option is to navigate to Assets | Export Package. Both options result in the same outcome.

In addition to the ability to export packages from Unity, we can also import asset packages into Unity. To import an asset package, we simply navigate to Assets | Import Package menu option:

When importing asset packages, we can select from one...

Unity Asset Store


Unity operates a store called the Unity Asset Store. There are a great number of assets available to Unity developers. The store is accessible directly on the Web at http://assetstore.unity3d.com. You can also open a window within Unity to display the Asset Store. This is accomplished by navigating to Window | Asset Store.

Regardless of how you connect to the Unity Asset Store, you'll see a hierarchical category listing in the top-right corner of the store:

Clicking on the triangular icons to the left of each category reveals subcategories. Some categories have multiple subcategories, which helps you find what you are looking for quickly.

When you click on a category, its contents will be viewable. Clicking on a specific asset will display several characteristics of that asset. These characteristics include:

  • Title

  • Publisher

  • Rating

  • Price

  • Purchase button or, in the case of free assets, an "Open in Unity" button

  • Version of Unity required

  • Description

  • Package contents

  • File size

  • Version number...

Adding assets to your game


Let's add some assets to our Little Farmer Colt game. First, we'll visit the Unity Asset Store, select an asset, inspect it, download it, and add it to our game. Next, we'll import a custom asset package.

Using the Unity Asset Store

The following steps illustrate how to find an asset from the Unity Asset Store and add it to our game. We'll look at specific characteristics of the asset, so you know what to look at when using the store.

  1. Launch Unity and open your project. Remember, we named our project LittleFarmerColt.

  2. Open your scene by navigating to File | Open Scene menu selection. This will bring up a Load Scene file dialog box with your project's Assets folder displayed. The name of my scene is FarmScene. Double-click on the scene file to open it. Alternatively, single-click on the scene file and click on the Open button, as shown in the following screenshot:

    Now we are ready to open the Unity Asset Store. We will search for an object appropriate for our game.

  3. From...

Using Blender to create assets for your game


We previously discussed the ability for us to create assets outside of Unity, export them into a format compatible with Unity, and then import them into our game. In this section, we'll do just that.

There are several tools that can be used to create 3D objects for use in Unity. One of the most commonly used is Blender. Blender is a free and open source 3D modeling program that has an impressive array of capabilities. There are several books and online tutorials that can teach you how to use Blender to create assets. Teaching you how to create them from scratch is beyond the scope of this book.

What we do have time to discuss is how to take a Blender object and export it into a Unity-supported format. Let's do that together by performing the following steps:

  1. If you do not already have a copy of Blender on your computer, download a copy from http://www.blender.org.

  2. Download the corn_stalk.blend file from this book's web page.

  3. Launch Blender.

  4. In Blender...

Summary


In this chapter, we covered Unity assets and asset packages. You visited the Unity Asset Store and reviewed what information is available on assets located in the Store. You gained experience downloading and importing assets into your game. You also learned a little about how to create 3D objects using Blender, a free and open-source 3D modeling tool.

In the next chapter, you'll animate the game's characters. The animations will include idle animations for all characters, both human and animal, talk animations for the farmers. Colt, our player-controlled character, will also receive walk and take animations. The take animation will be for the harvesting of corn and water. And, just for fun, we'll give Colt the ability to jump.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Getting Started with Unity 5
Published in: May 2015Publisher: ISBN-13: 9781784398316
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime

Author (1)

author image
Dr. Edward Lavieri

Dr. Edward Lavieri is a veteran software engineer and developer with a strong academic background. He earned a Doctorate of Computer Science from Colorado Technical University, an MS in Management Information Systems (Bowie State University), an MS in Education (Capella University), and an MS in Operations Management (University of Arkansas). He has been creating and teaching computer science courses since 2002. Edward retired from the U.S. Navy as a Command Master Chief after 25 years of active service. He is the founder and creative director of three19, a software design and development studio. Edward has authored more than a dozen technology books, including several on Java.
Read more about Dr. Edward Lavieri