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

Creating projects

Now that we have Unity installed, we can start creating our game. To do so, we first need to create a project, which is basically a folder containing all the files that your game will be composed of. These files are called assets and there are different types of them, such as images, audio, 3D models, script files, and so on. In this section, we will see how to manage a project, addressing the following concepts:

  • Creating a project
  • Project structure

Let’s learn first how to create a blank project to start developing our project.

Creating a project

As with Unity installations, we will use the Unity Hub to manage projects. We need to follow these next steps to create one:

  1. Open the Unity Hub and click on the Projects button, and then click on New project:

Figure 1.17: Creating a new project in Unity Hub

  1. Pick the 3D (URP) template as we will be creating a 3D game with simple graphics, prepared to run on every device Unity can be executed on, so the Universal Render Pipeline (or URP) is the better choice for that. In Chapter 10, Materials and Effects with URP and Shader Graph, we will be discussing exactly why.
  2. If you see a Download template button, click it; if not, that means you already have the template:

Figure 1.18: Downloading the 3D URP template

  1. Choose a Project name and a Location, and click Create project:

Figure 1.19: Selecting the Universal Render Pipeline template

  1. Unity will create and automatically open the project. This can take a while, but after that you will see a window similar to the one in the following image. You might see the dark-themed editor instead, but for better clarity we will use the light theme throughout the book. Feel free to keep the dark theme:

Figure 1.20: The Unity Editor window

  1. Close the window, then go back to Unity Hub and pick the project from the list to open it again:

Figure 1.21: Reopening the project

Now that we have created the project, let’s explore its structure.

Project structure

We have just opened Unity, but we won’t start using it until the next chapter. Now, it’s time to see how the project folder structure is composed. To do so, we need to open the folder in which we created the project. If you don’t remember where this is, you can do the following:

  1. Right-click the Assets folder in the Project panel, located at the bottom part of the editor.
  2. Click the Show in Explorer option (if you are using a Mac, the option is called Reveal in Finder). The following screenshot illustrates this:

Figure 1.22: Opening the project folder in Explorer

  1. Then, you will see a folder structure similar to this one (some files or folders may vary):

Figure 1.23: Unity project folder structure

If you want to move this project to another PC or send it to a colleague, you can just compress all those files and send it to them as a ZIP file, but not all the folders are necessary all of the time. The important folders are Assets, Packages, and ProjectSettings. Assets will hold all the files we will create and use for our game, so this is a must. We will also configure different Unity systems to tailor the engine to our game; all the settings related to this are in the ProjectSettings and UserSettings folders. Finally, we will install different Unity modules or packages to expand its functionality, so the Packages folder will hold which ones we are using.

It’s not necessary to copy the rest of the folders if you need to move the project elsewhere or add it to any versioning system, but let’s at least discuss what the Library folder is, especially considering it’s usually a huge size. Unity needs to convert the files we will use to its own format in order to operate, and an example would be audio and graphics. Unity supports MPEG Audio Layer 3 (MP3), Waveform Audio File Format (WAV), Portable Network Graphics (PNG), and Joint Photographic Experts Group (JPG) files (and much more), but prior to using them, they need to be converted to Unity’s internal formats, a process called Importing Assets. Those converted files will be in the Library folder. If you copy the project without that folder, Unity will simply take the original files in the Assets folder and recreate the Library folder entirely. This process can take time, and the bigger the project, the more time involved.

Keep in mind that you want to have all the folders Unity created while you are working on the project, so don’t delete any of them while you work on it, but if you need to move an entire project, you now know exactly what you need to take with you.

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}