Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Hands-On Unity 2022 Game Development - Third Edition

You're reading from  Hands-On Unity 2022 Game Development - Third Edition

Product type Book
Published in Oct 2022
Publisher Packt
ISBN-13 9781803236919
Pages 712 pages
Edition 3rd Edition
Languages
Author (1):
Nicolas Alejandro Borromeo Nicolas Alejandro Borromeo
Profile icon Nicolas Alejandro Borromeo

Table of Contents (23) Chapters

Preface 1. Creating a Unity Project 2. Editing Scenes and Game Objects 3. Grayboxing with Terrain and ProBuilder 4. Importing and Integrating Assets 5. Introduction to C# and Visual Scripting 6. Implementing Movement and Spawning 7. Physics Collisions and Health System 8. Win and Lose Conditions 9. Implementing Game AI for Building Enemies 10. Materials and Effects with URP and Shader Graph 11. Visual Effects with Particle Systems and Visual Effect Graph 12. Lighting Using the Universal Render Pipeline 13. Full-Screen Effects with Post-Processing 14. Sound and Music Integration 15. User Interface Design 16. Creating a UI with the UI Toolkit 17. Creating Animations with Animator, Cinemachine, and Timeline 18. Optimization with Profiler, Frame Debugger, and Memory Profiler 19. Generating and Debugging an Executable 20. Augmented Reality in Unity 21. Other Books You May Enjoy
22. Index

Grayboxing with Terrain and ProBuilder

Now that we’ve grasped all the necessary concepts to use Unity, let’s start designing our first level. The idea in this chapter is to learn how to use Terrain Tools to create the landscape of our game and then use ProBuilder to create the 3D mesh of the base with greater detail than using cubes. At the end of the chapter, you will be able to create a prototype of any kind of scene and try out your idea before actually implementing it with final graphics.

Specifically, we will examine the following concepts in this chapter:

  • Defining our game concept
  • Creating a landscape with Terrain
  • Creating shapes with ProBuilder

Let’s start by talking about our game concept, which will help us draft the first level environment.

Defining our game concept

Before even adding the first cube to our scene, it is good to have an idea of what we are going to create, as we will need a basic concept of our game to start designing the first level. Throughout this book, we will be creating a shooter game, in which the player will be fighting against waves of enemies trying to destroy the player’s base.

This base will be a complex in a (not so) secret location bordered by mountains:

Figure 3.1: Our finished game

We will be defining the mechanics of our game as we progress through the book, but with this basic high-level concept of the game we can start thinking about how to create a mountainous landscape and a placeholder player’s base to start.

With that in mind, in the next section of this chapter we will learn how to use Unity’s Terrain Tools to create our scene’s landscape.

Creating a landscape with Terrain

So far, we have used cubes to generate our level prototype, but we also learned that those shapes sometimes cannot represent all possible objects we could need. Imagine something irregular, such as a full terrain with hills, canyons, and rivers. This would be a nightmare to create using cubes given the irregular shapes you find in the terrain. Another option would be to use 3D modeling software, but the problem with that is that the generated model will be so big and so detailed that it won’t perform well, even on high-end PCs. In this scenario, we need to learn how to use Unity’s Terrain system, which we will do in this first section of the chapter.

In this section, we will cover the following concepts related to terrains:

  • Discussing Height Maps
  • Creating and configuring Height Maps
  • Authoring Height Maps
  • Adding Height Map details

Let’s start by talking about Height Maps, whose textures...

Creating shapes with ProBuilder

So far, we have created simple scenes using cubes and primitive shapes, and that’s enough for most of the prototypes you will create, but sometimes, you will have tricky areas of the game that would be difficult to model with regular cubes, or maybe you want to have some deeper details in certain parts of your game to get an idea of how the player will experience that area.

In this case, we can use any 3D modeling tool for this, such as 3D Studio Max, Maya, or Blender, but they can be difficult to learn and you probably won’t need all their power at this stage in your development. Luckily, Unity has a simple 3D model creator called ProBuilder, so let’s explore it.

In this section, we will cover the following concepts related to ProBuilder:

  • Installing ProBuilder
  • Creating a shape
  • Manipulating the mesh
  • Adding details

ProBuilder is not included by default in our Unity project, so let’...

Summary

In this chapter, we learned how to create large terrain meshes using Height Maps and Unity Terrain Tools such as Paint Height and Set Height to create hills and rivers. Also, we saw how to create our own 3D meshes using ProBuilder, as well as how to manipulate the vertices, edges, and faces of a model to create a prototype base model for our game. We didn’t discuss any performance optimizations we can apply to our meshes or advanced 3D modeling concepts as that would require entire chapters and is beyond the scope of this book. Right now, our main focus is prototyping, so we are fine with our level’s current status.

In the next chapter, we will learn how to download and replace these prototyping models with final art by integrating assets (files) we have created with external tools. This is the first step to improving the graphics quality of our game, which we will finish by the end of Part 3, Improving Graphics.

Join us on Discord!

Read this...

lock icon The rest of the chapter is locked
You have been reading a chapter from
Hands-On Unity 2022 Game Development - Third Edition
Published in: Oct 2022 Publisher: Packt ISBN-13: 9781803236919
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.
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 $15.99/month. Cancel anytime}