Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Hands-On Unity 2020 Game Development

You're reading from   Hands-On Unity 2020 Game Development Build, customize, and optimize professional games using Unity 2020 and C#

Arrow left icon
Product type Paperback
Published in Jul 2020
Last Updated in Jun 2025
Publisher Packt
ISBN-13 9781838642006
Length 580 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Nicolas Alejandro Borromeo Nicolas Alejandro Borromeo
Author Profile Icon Nicolas Alejandro Borromeo
Nicolas Alejandro Borromeo
Arrow right icon
View More author details
Toc

Table of Contents (24) Chapters Close

Preface 1. Chapter 1: Designing a Game from Scratch 2. Chapter 2: Setting Up Unity FREE CHAPTER 3. Chapter 3: Working with Scenes and GameObjects 4. Chapter 4: Grayboxing with Terrain and ProBuilder 5. Chapter 5: Importing and Integrating Assets 6. Chapter 6: Materials and Effects with URP and Shader Graph 7. Chapter 7: Visual Effects with Particle Systems and VFX Graph 8. Chapter 8: Lighting Using the Universal Render Pipeline 9. Chapter 9: Fullscreen Effects with postprocessing 10. Chapter 10: Sound and Music Integration 11. Chapter 11: User Interface Design 12. Chapter 12: Creating Animations with Animator, Cinemachine, and Timeline 13. Chapter 13: Introduction to Unity Scripting with C# 14. Chapter 14: Implementing Movement and Spawning 15. Chapter 15: Physics Collisions and Health System 16. Chapter 16: Win and Lose Conditions 17. Chapter 17: Scripting the UI, Sounds, and Graphics 18. Chapter 18: Implementing Game AI for Building Enemies 19. Chapter 19: Scene Performance Optimization 20. Chapter 20: Building the Project 21. Chapter 21: Finishing Touches 22. Chapter 22: Augmented Reality in Unity 23. Other Books You May Enjoy

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

Creating a project

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

  1. Open Unity Hub and click on the Projects button, and then click on NEW, as illustrated in the following screenshot:
    Figure 2.12 – Creating a new project in Unity Hub

    Figure 2.12 – Creating a new project in Unity Hub

  2. Pick the Universal Render Pipeline template, then a project name and a location, and hit Create. 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 6, Materials and Effects with URP and Shader Graph, we will be discussing exactly why. The process can be seen in the following screenshot:
    Figure 2.13 – Selecting the Universal Render Pipeline template

    Figure 2.13 – Selecting the Universal Render Pipeline template

    Important Note:

    Try to put the project in Dropbox, Google Drive, or any cloud-synchronized folder to make sure you always have the project at hand. This project will grow, so make sure you have enough space in that folder. If you don't have enough space in your hosting service, just skip this. If you know how to use Git, that would be a better option.

  3. Unity will create and automatically open the project. This can take a while, but after that, you will see a screen similar to the one shown in the following screenshot:
    Figure 2.14 – The Unity Editor window

    Figure 2.14 – The Unity Editor window

  4. Try closing the window and opening it again, then going back to Unity Hub and picking the project from the list, as follows:
Figure 2.15 – Reopening the project

Figure 2.15 – 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 in 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 2.16 – Opening the project folder in Explorer

Figure 2.16 – Opening the project folder in Explorer

Then, you will see the following folder structure:

Figure 2.17 – Unity project folder structure

Figure 2.17 – Unity project folder structure

If anytime 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. The Assets folder 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 folder. Finally, we will install different Unity modules or packages to expand its functionality, so the Packages folder will hold which ones we are using, for Unity to be aware of that. It's not necessary to copy the rest of the folders if you need to move the project elsewhere, but let's at least discuss what the Library folder is.

Unity needs to convert the files we will use into 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 into Unity's internal formats. 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.

Take into account 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 doing so, but if you need to move an entire project, you now know exactly what you need to take with you.

Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Hands-On Unity 2020 Game Development
You have been reading a chapter from
Hands-On Unity 2020 Game Development
Published in: Jul 2020
Publisher: Packt
ISBN-13: 9781838642006
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 $19.99/month. Cancel anytime
Modal Close icon
Modal Close icon