Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Learning C# by Developing Games with Unity
Learning C# by Developing Games with Unity

Learning C# by Developing Games with Unity: Get to grips with coding in C# and build simple 3D games in Unity 2023 from the ground up , Seventh Edition

Arrow left icon
Profile Icon Harrison Ferrone
Arrow right icon
Can$56.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.4 (47 Ratings)
Paperback Nov 2022 466 pages 7th Edition
eBook
Can$31.99 Can$45.99
Paperback
Can$56.99
Subscription
Free Trial
Arrow left icon
Profile Icon Harrison Ferrone
Arrow right icon
Can$56.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.4 (47 Ratings)
Paperback Nov 2022 466 pages 7th Edition
eBook
Can$31.99 Can$45.99
Paperback
Can$56.99
Subscription
Free Trial
eBook
Can$31.99 Can$45.99
Paperback
Can$56.99
Subscription
Free Trial

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
Table of content icon View table of contents Preview book icon Preview Book

Learning C# by Developing Games with Unity

Getting to Know Your Environment

Pop culture likes to market computer programmers as outsiders, lone wolves, or geeky hackers; people who possess extraordinary mental gifts for algorithmic thought, little social IQ, and the odd anarchic bent. While this isn’t the case, there is something to the idea that learning to code fundamentally changes the way you look at the world.

The good news is that your naturally curious mind already wants to see these kinds of patterns in the world, and you may even come to enjoy this new way of thinking. From the moment your eyes snap open in the morning to the last glimpse of your ceiling fan before you go to sleep, you’re unconsciously using analytical skills that directly translate to programming—you’re just missing the right language and syntax to map those life skills into code.

You know your age, right? That’s a variable. When you cross the street, I presume you look down the road in both directions before stepping off the curb like the rest of us. That’s evaluating different conditions, better known as control flow in programming terminology. When you look at a can of soda, you instinctively identify that it has certain properties, like shape, weight, and contents. That’s a class object! You get the idea.

With all that real-world experience at your fingertips, you’re more than ready to cross over into the realm of programming. To kick off your journey, you’ll need to know how to set up your development environment, work with the applications involved, and know exactly where to go when you need help.

To those ends, we’re going to begin by delving into the following C# topics:

  • Getting started with Unity 2023
  • Using C# with Unity
  • Exploring the documentation

Let’s get started!

Technical requirements

Sometimes it’s easier to start with what a thing isn’t, rather than what it is. The goal of this book isn’t to teach you everything there is to know about the Unity game engine or game development. By necessity, we’ll cover these topics at a basic level at the beginning of our journey, and in more detail in Chapter 6, Getting Your Hands Dirty with Unity. These topics are included to provide a fun, accessible way to learn the C# programming language from the ground up, not an in-depth Unity tutorial. With programming as our main goal, there will be times when we opt for a code-based solution even though Unity may have a specific feature that does the same thing without any code. Don’t worry, I’ll point you in the right direction should you want to try them out later on in your game development journey!

Since this book is aimed at complete beginners to programming, if you have no previous experience with either C# or Unity, you’re in the right place! If you’ve had some experience with the Unity Editor but not with programming, guess what? This is still the place to be. Even if you’ve dabbled in a bit of C# mixed with Unity, but want to explore some more intermediate or advanced topics, the later chapters of this book can provide you with what you’re looking for.

If you’re an experienced programmer in other languages, feel free to skip the beginner theory and dive right into the parts you’re interested in, or stick around and refresh your fundamentals.

Getting started with Unity 2023

If you don’t have Unity installed (or are running an earlier version), follow these steps to set up your environment:

  1. Head over to https://www.unity.com/.
  2. Select Download (shown in Figure 1.1):

    Figure 1.1: Unity homepage

    To provide a complete view of the Unity editor, all our screenshots are taken in full-screen mode. For color versions of all book images, use the link below: https://packt.link/7yy5V.

  3. This will take you to the Unity store page. Don’t feel overwhelmed by this—you can download Unity completely for free!

    If the Unity homepage looks different for you than what you can see in Figure 1.1, you can go directly to https://store.unity.com.

  4. Scroll down to the How to get started section and download the Unity Hub application for either Windows or Mac, as shown in Figure 1.2. I’ll be using a Mac, but everything works the same on a Windows machine:

    Figure 1.2: Start creating with the Unity portal

  5. Once the download is complete, follow these steps:
    1. Open up the installer (by double-clicking it)
    2. Accept the user agreement
    3. Follow the installation instructions
  6. When you get the green light, go ahead and fire up the Unity Hub application!
    1. If Unity asks you to choose a license option, select the Personal license option (which is completely free) and follow the instructions to set up your account.
  7. The newest version of Unity Hub will prompt you to install the latest LTS (Long Term Support) version of Unity, as shown in Figure 1.3. If the default version is Unity 2023 or higher when you’re reading these instructions, select Install Unity Editor:

    Figure 1.3: Install Unity Editor window

  8. If Unity 2023 is not the default version when you’re reading this, select Skip installation in the bottom-right corner of Figure 1.4:

    Figure 1.4: Install wizard

  9. Switch to the Installs tab from the left-hand menu and select Install Editor, as shown in Figure 1.5:

    Figure 1.5: Unity Hub Installs panel

  10. On the Official releases tab, select your desired version of Unity, then click Install (Silicon for Macs, Intel for Windows). At the time of writing, Unity 2023 is listed under the OTHER VERSIONS section of the Official releases tab, but you should be able to select a 2023 version from the Official releases list by the time you’re reading this:

    Figure 1.6: Add Unity version pop-up window

  11. You’ll then be given the option to add various modules to your installation. Make sure the Visual Studio (for Mac or Windows accordingly) module is selected and click Continue:

    Figure 1.7: Adding install modules

  12. If you want to add any modules later, you can click the gear icon to the right of any installed version in the Installs window.

When the installation is complete, you’ll see a new version in your Installs panel, as follows:

Figure 1.8: Installs tab with Unity versions

You can find additional information and resources about the Unity Hub application at https://docs.unity3d.com/hub/manual/index.html.

There’s always a chance of something going wrong, so be sure to check the following section if you’re using macOS Catalina or later, which has been known to throw up issues.

Using macOS

If you’re working on a Mac with OS Catalina or later, there is a known issue when using some versions of Unity Hub to install Unity. If this is the case for you, take a deep breath, go to the Unity download archive, and grab the 2023 version you need (https://unity3d.com/get-unity/download/archive). Remember to use the Downloads (Mac) or Downloads (Win) option instead of the Unity Hub download:

Figure 1.9: Unity download archive

Once the installer application downloads, open it up and follow the setup instructions! All of the examples and screenshots for this book were created and captured using Unity 2023.1.5f1. If you’re using a newer version, things might look slightly different in the Unity Editor, but this shouldn’t affect your following along.

Now that Unity Hub and Unity 2023 are installed, it’s time to create a new project!

Creating a new project

Launch the Unity Hub application, which is your staging area—you can see a list of all your projects and Unity versions and access learning resources and community features here. Then, take the following steps:

  1. To get started, click on New project in the top-right corner:

    Figure 1.10: Unity Hub Projects panel

  2. Make sure the editor version at the top is set to your 2023 version and set the following fields:
    • Templates: The project will default to 3D Core
    • Project name: I’ll be calling mine Hero Born
    • Location: Wherever you’d like the project to be saved
  3. Once the settings have been configured, hit Create project:

    Figure 1.11: Unity Hub with New project configuration popup

With the project created, you’re all set to explore the Unity interface! You can re-open your project anytime from the Projects panel in Unity Hub, but if your computer is running a little slow with both Unity and Unity Hub open, feel free to close Unity Hub.

Navigating the editor

When the new project finishes initializing, you’ll see the glorious Unity Editor! I’ve marked the important tabs (or windows, if you prefer) in Figure 1.12:

Figure 1.12: Unity interface

This is a lot to take in, so we’ll look at each of these panels in more detail:

  1. The Toolbar panel is the topmost part of the Unity Editor. From here, you can sign in to a Unity account, manage services, access the Asset Store, collaborate with a team (far-left button group), and play and pause the game (the center buttons). The right-most button group contains a search feature, LayerMasks, and layout scheme features, which we won’t be using in this book because they don’t apply to learning C#.
  2. The Hierarchy window shows every item currently in the game scene. In the starter project, this is just the default camera and directional light, but when we create our prototype environment, this window will start to get filled in with the objects we create in the scene.
  3. The Game and Scene windows are the most visual aspects of the editor. Think of the Scene window as your stage, where you can move and arrange 2D and 3D objects. When you hit the Play button, the Game window will take over, rendering the Scene view and any programmed interactions. You can also use the Scene view when you’re in play mode.
  4. The Inspector window is your one-stop shop for viewing and editing the properties of objects in the scene. If you select Main Camera in the Hierarchy (highlighted in blue in the above screenshot), you’ll see several parts displayed, which Unity calls components—all of which are accessible from the Inspector.
  5. The Project window holds every asset that’s currently in your project. Think of this as a representation of your project’s folders and files.
  6. The Console window is where any output we want our scripts to print will show up. From here on out, if we talk about the console or debug output, this panel is where it will be displayed.

If any of these windows get closed by accident, you can re-open them anytime from the Unity menu > Window > General. You can find more in-depth breakdowns of each window’s functionality in the Unity docs at: https://docs.unity3d.com/Manual/UsingTheEditor.html.

Before continuing, it’s important that Visual Studio is set up as the script editor for your project. Go to the Unity menu > Preferences > External Tools and check that External Script Editor is set to Visual Studio for Mac (or Windows):

Figure 1.13: Changing External Script Editor to Visual Studio

As a final tip, if you want to switch between light and dark modes, go to the Unity menu > Preferences > General and change Editor Theme:

Figure 1.14: Unity general preferences panel

I know that was a lot to process if you’re new to Unity, but rest assured that any instructions going forward will always reference the necessary steps. I won’t leave you wondering what button to push. With that out of the way, let’s start creating some actual C# scripts.

Using C# with Unity

Going forward, it’s important to think of Unity and C# as symbiotic entities. Unity is the engine where you’ll create scripts and GameObjects, but the actual programming takes place in another program called Visual Studio.

Working with C# scripts

We haven’t covered any basic programming concepts yet, but they won’t have a home until we know how to create an actual C# script in Unity. A C# script is a special kind of C# file in which you’ll write C# code. These scripts can be used in Unity to do virtually anything, from controlling an in-game character with your keyboard, to animating objects in your level.

There are several ways to create C# scripts from the editor:

  • Select Assets > Create > C# Script
  • Right under the Project tab, select the + icon and choose C# Script
  • Right-click on the Assets folder in the Project tab and select Create > C# Script from the pop-up menu
  • Select any GameObject in the Hierarchy window and click Add Component > New Script

Going forward, whenever you’re instructed to create a C# script, please use whichever method you prefer.

Resources and objects other than C# scripts can be created in the editor using the preceding methods. I’m not going to call out each of these variations every time we create something new, so just keep the options in the back of your mind.

For the sake of organization, we’re going to store our various assets and scripts inside their own named folders. This isn’t just a Unity-related task—it’s something you should always do, and your co-workers will thank you (I promise):

  1. Select Assets > Create > Folder and name it Scripts:

    Figure 1.15: Creating a C# script

  2. Double-click on the Scripts folder and create a new C# script. By default, the script will be named NewBehaviourScript, but you’ll see the filename highlighted, so you have the option to immediately rename it. Type in LearningCurve and hit Enter:

    Figure 1.16: Project window with the Scripts folder selected

  3. You can use the small slider in the bottom right of the Project tab to change how your files are displayed.

So, you’ve just created a subfolder named Scripts, as shown in the preceding screenshot. Inside that parent folder, you created a C# script named LearningCurve.cs (the .cs file type stands for C-Sharp, in case you were wondering), which is now saved as part of our Hero Born project assets. All that’s left to do is open it up in Visual Studio!

Introducing the Visual Studio editor

While Unity can create and store C# scripts, they need to be edited using Visual Studio. A copy of Visual Studio comes pre-packaged with Unity and will open up automatically when you double-click any C# script from inside the editor.

Opening a C# file

Unity will synchronize with Visual Studio the first time you open a file. The simplest way to do this is by selecting the script from the Project tab. Take the following steps:

  1. Double-click on LearningCurve.cs, which will open up the C# file in Visual Studio:

    Figure 1.17: LearningCurve C# script in Visual Studio

  2. You can change the Visual Studio tabs at any time from Visual Studio | View | Layout. I’ll be using the Design layout for the rest of the book so we can see our project files on the left-hand side of the editor.
  3. You’ll see a folder structure on the left-hand side of the interface that mirrors the one in Unity, which you can access like any other. On the right-hand side is the actual code editor where the magic happens (all the code you write will live here). There are far more features to the Visual Studio application, but this is all we need to get started.

The Visual Studio interface is different for Windows and Mac environments, but the code we’ll be using throughout this book will work equally well with both. All the screenshots in this book have been taken in a Mac environment, so if things look different on your computer, there’s no need to worry.

Beware of naming mismatches

One common pitfall that trips up new programmers is file naming—more specifically, naming mismatches—which we can illustrate using line 5 from Figure 1.17 of the C# file in Visual Studio:

public class LearningCurve : MonoBehaviour

The LearningCurve class name is the same as the LearningCurve.cs filename. This is an essential requirement. It’s OK if you don’t know what a class is quite yet. The important thing to remember is that, in Unity, the filename and the class name need to be the same. If you’re using C# outside of Unity, the filename and class name don’t have to match.

When you create a C# script file in Unity, the filename in the Project tab is already in Edit mode, ready to be renamed. It’s a good habit to rename it then and there. If you rename the script later, the filename and the class name won’t match.

If you were to rename the file at a later point, the filename would change, but line 5 would be as follows:

public class NewBehaviourScript : MonoBehaviour

If you accidentally do this, it’s not the end of the world. All you need to do is right-click on the script in the Projects tab and choose Rename:

Figure 1.18: Renaming a C# script

Syncing C# files

As part of their symbiotic relationship, Unity and Visual Studio communicate with each other to synchronize their content. This means that if you add, delete, or change a script file in one application, the other application will see the changes automatically.

So, what happens when Murphy’s Law, which states that “anything that can go wrong will go wrong,” strikes and syncing just doesn’t seem to be working correctly? If you run into this situation, take a deep breath, select the troublesome script in Unity, right-click, and select Refresh.

Figure 1.19: Refreshing a C# script

You now have the basics of script creation under your belt, so it’s time we talk about finding and efficiently using helpful resources.

Exploring the documentation

The last topic we’ll touch on in this first foray into Unity and C# scripts is documentation. Not sexy, I know, but it’s important to form good habits early when dealing with new programming languages or development environments.

Accessing Unity’s documentation

Once you start writing scripts in earnest, you’ll be using Unity’s documentation quite often, so it’s beneficial to know how to access it early on. The Reference Manual will give you an overview of a component or topic, while specific programming examples can be found in the Scripting Reference.

Every GameObject (an item in the Hierarchy window) in a scene has a Transform component that controls its Position, Rotation, and Scale. To keep things simple, we’ll just look up the camera’s Transform component in the Reference Manual:

  1. In the Hierarchy tab, select the Main Camera GameObject.
  2. Move over to the Inspector tab and click on the information icon (question mark, ?) at the top right of the Transform component:

    Figure 1.20: Main Camera GameObject selected in the Inspector

  3. You’ll see a web browser open on the Transforms page of the Reference Manual:

    Figure 1.21: Unity Reference Manual

All the components in Unity have this feature, so if you ever want to know more about how something works, you know what to do.

So, we’ve got the Reference Manual open, but what if we wanted concrete coding examples related to the Transform component? It’s pretty simple—all we need to do is ask the Scripting Reference:

  1. Click on the SWITCH TO SCRIPTING link underneath the component or class name (Transforms, in this case):

    Figure 1.22: Unity Reference Manual with the SWITCH TO SCRIPTING button highlighted

  2. By doing so, the Reference Manual automatically switches to the Scripting Reference:

    Figure 1.23: Unity scripting documentation with SWITCH TO MANUAL

  3. As you can see, as well as coding help, there is also an option to switch back to the Reference Manual if necessary.

The Scripting Reference is a large document because it has to be. However, this doesn’t mean you have to memorize it or even be familiar with all of its information to start writing scripts. As the name suggests, it’s a reference, not a test.

If you find yourself lost in the documentation, or just out of ideas regarding where to look, you can also find solutions within the rich Unity development community in the following places:

On the other side of things, you’ll need to know where to find resources on any C# question, which we’ll cover next.

Locating C# resources

Now that we’ve got our Unity resources taken care of, let’s take a look at some of Microsoft’s C# resources. For starters, the Microsoft Learn documentation at https://docs.microsoft.com/en-us/dotnet/csharp has a ton of great tutorials, quick start guides, and how-to articles. You can also find great overviews of individual C# topics at: https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/index.

However, if you want detailed information on a specific C# language feature, the reference guides are the place to go. These reference guides are an important resource for any C# programmer, but since they aren’t always the easiest to navigate, let’s take a few minutes to learn how to find what we’re looking for.

Let’s load up the programming guide link (https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/index) and scroll down to Language Sections and click on the Strings link directly:

Figure 1.24: Navigating Microsoft’s C# reference guide

You should see something like the following for the class description page:

Figure 1.25: Microsoft’s Strings (C# Programming Guide) page

Unlike Unity’s documentation, the C# reference and scripting information is all bundled up into one, but its saving grace is the subtopic list on the right-hand side. Use it well! It’s extremely important to know where to find help when you’re stuck or have a question, so be sure to circle back to this section whenever you hit a roadblock.

Summary

We covered quite a bit of logistical information in this chapter, so I can understand if you’re itching to write some code. Starting new projects, creating folders and scripts, and accessing documentation are topics that are easily forgotten in the excitement of a new adventure. Just remember that this chapter has a lot of resources you might need in the coming pages, so don’t be afraid to come back and visit. Thinking like a programmer is like strengthening a muscle: the more you work it, the stronger it gets.

In the next chapter, we’ll start laying out the theory, vocabulary, and main concepts you’ll need to prime your coding brain. Even though the material is conceptual, we’ll still be writing our first lines of code in the LearningCurve script. Get ready!

Pop quiz—dealing with scripts

  1. What type of relationship do Unity and Visual Studio share?
  2. The Scripting Reference supplies example code in regard to using a particular Unity component or feature. Where can you find more detailed (non-code-related) information about Unity components?
  3. The Scripting Reference is a large document. How much of it do you have to memorize before attempting to write a script?
  4. When is the best time to name a C# script?

Don’t forget to check your answers against mine in the Pop Quiz Answers appendix to see how you did!

Join us on discord!

Read this book alongside other users, Unity game development experts and the author himself.

Ask questions, provide solutions to other readers, chat with the author via Ask Me Anything sessions and much more.

Scan the QR code or visit the link to join the community.

https://packt.link/csharpwithunity

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Develop a strong foundation of programming concepts and the C# language
  • Become confident with Unity fundamentals and features in line with Unity 2023
  • Build a playable game prototype in Unity—a working first-person shooter game prototype

Description

It's the ability to write custom C# scripts for behaviors and game mechanics that really takes Unity the extra mile. That's where this book can help you as a new programmer! Harrison Ferrone, in this seventh edition of the bestselling series will take you through the building blocks of programming and the C# language from scratch while building a fun and playable game prototype in Unity. This book will teach you the fundamentals of OOPs, basic concepts of C#, and Unity engine with lots of code samples, exercises and tips to go beyond the book with your work. You will write C# scripts for simple game mechanics, perform procedural programming, and add complexity to your games by introducing intelligent enemies and damage-dealing projectiles. You will explore the fundamentals of Unity game development, including game design, lighting basics, player movement, camera controls, collisions, and more with every passing chapter. Note: The screenshots in the book display the Unity editor in full-screen mode for a comprehensive view. Users can easily reference color versions of images by downloading them from the GitHub repository or the graphics bundle linked in the book.

Who is this book for?

If you're a developer, programmer, hobbyist, or anyone who wants to get started with Unity and C# programming in a fun and engaging manner, this book is for you. You'll still be able to follow along if you don't have programming experience, but knowing the basics will help you get the most out of this book.

What you will learn

  • Understanding programming fundamentals by breaking them down into their basic parts
  • Comprehensive explanations with sample codes of object-oriented programming and how it applies to C#
  • Follow simple steps and examples to create and implement C# scripts in Unity
  • Divide your code into pluggable building blocks using interfaces, abstract classes, and class extensions
  • Grasp the basics of a game design document and then move on to blocking out your level geometry, adding lighting and a simple object animation
  • Create basic game mechanics such as player controllers and shooting projectiles using C#
  • Become familiar with stacks, queues, exceptions, error handling, and other core C# concepts
  • Learn how to handle text, XML, and JSON data to save and load your game data
Estimated delivery fee Deliver to Canada

Economy delivery 10 - 13 business days

Can$24.95

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Nov 29, 2022
Length: 466 pages
Edition : 7th
Language : English
ISBN-13 : 9781837636877
Vendor :
Unity Technologies
Languages :
Concepts :
Tools :

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
Estimated delivery fee Deliver to Canada

Economy delivery 10 - 13 business days

Can$24.95

Product Details

Publication date : Nov 29, 2022
Length: 466 pages
Edition : 7th
Language : English
ISBN-13 : 9781837636877
Vendor :
Unity Technologies
Languages :
Concepts :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just Can$6 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just Can$6 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total Can$ 157.97 177.97 20.00 saved
Learning C# by Developing Games with Unity
Can$56.99
C# 11 and .NET 7 – Modern Cross-Platform Development Fundamentals
Can$43.99 Can$63.99
Hands-On Unity 2022 Game Development
Can$56.99
Total Can$ 157.97 177.97 20.00 saved Stars icon

Table of Contents

17 Chapters
Getting to Know Your Environment Chevron down icon Chevron up icon
The Building Blocks of Programming Chevron down icon Chevron up icon
Diving into Variables, Types, and Methods Chevron down icon Chevron up icon
Control Flow and Collection Types Chevron down icon Chevron up icon
Working with Classes, Structs, and OOP Chevron down icon Chevron up icon
Getting Your Hands Dirty with Unity Chevron down icon Chevron up icon
Movement, Camera Controls, and Collisions Chevron down icon Chevron up icon
Scripting Game Mechanics Chevron down icon Chevron up icon
Basic AI and Enemy Behavior Chevron down icon Chevron up icon
Revisiting Types, Methods, and Classes Chevron down icon Chevron up icon
Specialized Collection Types and LINQ Chevron down icon Chevron up icon
Saving, Loading, and Serializing Data Chevron down icon Chevron up icon
Exploring Generics, Delegates, and Beyond Chevron down icon Chevron up icon
The Journey Continues Chevron down icon Chevron up icon
Pop Quiz Answers Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.4
(47 Ratings)
5 star 74.5%
4 star 8.5%
3 star 8.5%
2 star 2.1%
1 star 6.4%
Filter icon Filter
Top Reviews

Filter reviews by




Thomas Luik Feb 21, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Feefo Verified review Feefo
Andy Jan 22, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Its good
Amazon Verified review Amazon
Eric Montoya Dec 03, 2023
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I have a digital copy of this book and is very comprehensive for beginners. Harrison teaches the reader the fundamentals of Unity and C# programming language. He gives easy to understand examples that the reader could easily comprehend. I highly recommend this book if you’re starting your Unity game developer journey.
Amazon Verified review Amazon
Troy Martin Feb 22, 2023
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I've been developing in C# for around 8 years and used Unity wayyy back in Unity 4.x. I've expanded my knowledge of C# (amongst other languages) considerably and decided to pick this book up (e-book) as I haven't used Unity since then.Harrison has done a wonderful job of introducing C# throughout the book while putting together a game which explains the various operations of Unity. The first couple of chapters can be skipped (or skimmed) if you are already familiar with the language but covers everything you need to know to get started with Unity.After that, he takes you through each individual aspect of making a game. This includes explaining all the various UI elements to Unity itself, handling projectiles and collision, world building, the Unity component system, saving and loading... everything you need to know to get started building the game you want to create. Throughout the book, Harrison adds more C# knowledge/features to continue expanding on what was introduced in the first few chapters.This is a great book that I would recommend to not only complete beginners but anyone who is looking to make the most out of Unity.
Amazon Verified review Amazon
triptych May 17, 2023
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Starting out in a career of coding and making games is a daunting challenge in this day and age. In order for you to be successful, you need the right tools and the right learnings to get you on a successful path. This book was sent to me as a free copy, but I would have easily made the financial commitment even after just looking through the summary.In short, you have a comprehensive guide to learning C# while getting familiar with the industry standard Unity engine. This is a powerful combination, which the author uses to help you build up your skills in game development with practical lessons and engaging writing. Even if you are relatively new to coding, you can use this book to get you started, because the author doesn't assume you're a technical expert but uses a very hands-on approach to every aspect of C# and helps you make the best use of Unity to create interesting games.I am going to come back to this book quite often in my gaming career and while I might use other tools or languages at some point, the foundations of not only C# but logical thinking and game making carry over into many applications. They update this book often as you can see this is the 7th edition, which gives me confidence that this book is up to date with modern standards and will stay relevant for years to come.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact customercare@packt.com with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at customercare@packt.com using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on customercare@packt.com with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on customercare@packt.com within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on customercare@packt.com who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on customercare@packt.com within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela