官术网_书友最值得收藏!

Importing assets

Assets are the raw materials for games—the building blocks from which they're made. Assets include meshes (or 3D models), such as characters, props, trees, houses, and more: textures, which are image files such as JPEGs and PNGs (these determine how the surface of a mesh should look); music and sound effects to enhance the realism and atmosphere of your game, and finally, scenes, which are 3D spaces or worlds where meshes, textures, sounds, and music live, exist, and work together holistically as part of a single system. Thus, games cannot exist without assets—they would otherwise look completely empty and lifeless. For this reason, we'll need assets to make the coin collection game we're working toward. After all, we'll need an environment to walk around and coins to collect!

Unity, however, is a game engine and not an asset creation program. This means that assets, such as characters and props, are typically made first by artists in external, third-party software. From here, they are exported and transferred ready-made to Unity, and Unity is responsible only for bringing these assets to life in a coherent game that can be played. Third-party asset creation programs include Blender (which is free of charge), Maya or 3DS Max to make 3D models, Photoshop or GIMP (which is free of charge) to create textures, and Audacity (which is free of cost) to generate audio. There are plenty of other options too. The details of these programs are beyond the scope of this book. In any case, Unity assumes that you already have assets ready to import to build a game. For the coin collection game, we'll use assets that ship with Unity. So let's import these to our project. To do this, select Assets | Import Package from the application menu. Then select Characters, ParticleSystems, Environment, and Prototyping. See Figure 1.9:

Figure 1.9: Importing assets via the Import Package menu

Each time you import a package from the menu, you'll be presented with an Import dialog. Simply leave all settings at their defaults, and click on Import. See Figure 1.10:

Figure 1.10: Choosing Assets to import

By default, Unity decompresses all files from the package (a library of assets) into the current project. After importing, lots of different assets and data will have been added to the Project, ready for use. These files are copies of the originals. So any changes made to the imported files will not affect or invalidate the originals, which Unity maintains internally. The files include models, sounds, textures, and more. These are listed in the Unity Editor from the Project panel. See the following screenshot:

Figure 1.11: Browsing imported assets from the Project panel

Tip

When selecting Assets | Import from the application menu, if you don't see all, or any, asset packages listed, you can download and install them separately from the Unity website at https://unity3d.com/. From the downloads page, choose the Additional Downloads option, and then select the Standard Assets package. See Figure 1.12.

Figure 1.12: Downloading the Standard Assets package

The imported assets don't exist yet in our game. They don't appear on screen, and they won't do anything yet! Rather, they're simply added to the Project panel, which behaves as a library or repository of assets, from which we can pick and choose to build up a game. The assets imported thus far are built-in into Unity and we'll be continually using them in subsequent sections to make a functional coin collection game. To get more information about each asset, you can select the asset by clicking on it with the mouse, and asset-specific details will be shown on the right-hand side of the Unity Editor in the Inspector. The Inspector is a property sheet editor that appears on the right-hand side of the interface. It is context-sensitive and always changes to display properties for the selected object. See Figure 1.13.

Figure 1.13: The Inspector displays all the properties for the currently selected object

主站蜘蛛池模板: 巴林左旗| 涟水县| 新民市| 西乌| 涞水县| 德阳市| 上高县| 皋兰县| 改则县| 惠水县| 平远县| 兰考县| 颍上县| 南漳县| 建昌县| 共和县| 尼木县| 炎陵县| 和龙市| 南和县| 岑溪市| 湖南省| 云林县| 遂平县| 泊头市| 安义县| 甘德县| 青田县| 灵山县| 兴仁县| 兴安盟| 资溪县| 岳阳市| 邵阳县| 九龙坡区| 眉山市| 秦皇岛市| 娄烦县| 衡水市| 凉山| 互助|