Learning C# by Developing Games with Unity 2020, 5th Edition PDF Free Download



Get to grips with coding in C# and build simple 3D games with Unity from the ground up with this updated fifth edition of the bestselling guide

Key Features

  • Understand C# programming basics, terminology, and coding best practices
  • Put your knowledge of C# concepts into practice by building a fun and playable game
  • Come away with a clear direction for taking your C# programming and Unity game development skills to the next level

Book Description

Over the years, the Learning C# by Developing Games with Unity series has established itself as a popular choice for getting up to speed with C#, a powerful and versatile programming language that can be applied in a wide array of application areas. This book presents a clear path for learning C# programming from the ground up without complex jargon or unclear programming logic, all while building a simple game with Unity.

This fifth edition has been updated to introduce modern C# features with the latest version of the Unity game engine, and a new chapter has been added on intermediate collection types. Starting with the basics of software programming and the C# language, you’ll learn the core concepts of programming in C#, including variables, classes, and object-oriented programming. Once you’ve got to grips with C# programming, you’ll enter the world of Unity game development and discover how you can create C# scripts for simple game mechanics. Throughout the book, you’ll gain hands-on experience with programming best practices to help you take your Unity and C# skills to the next level.

By the end of this book, you’ll be able to leverage the C# language to build your own real-world Unity game development projects.

What you will learn

  • Discover easy-to-follow steps and examples for learning C# programming fundamentals
  • Get to grips with creating and implementing scripts in Unity
  • Create basic game mechanics such as player controllers and shooting projectiles using C#
  • Understand the concepts of interfaces and abstract classes
  • Leverage the power of the latest C# features to solve complex programming problems
  • Become familiar with stacks, queues, exceptions, error handling, and other core C# concepts
  • Explore the basics of artificial intelligence (AI) for games and implement them to control enemy behavior

Who this book is for

If you’re a developer, programmer, hobbyist, or anyone who wants to get started with C# programming in a fun and engaging manner, this book is for you. Prior experience in programming or Unity is not required.

Table of Contents

  1. Getting to Know Your Environment
  2. The Building Blocks of Programming
  3. Diving into Variables,Types, and Methods
  4. Control Flow and Collection Types
  5. Working with Classes, Structs, and OOP
  6. Getting Your Hands Dirty with Unity
  7. Movement, Camera Controls, and Collisions
  8. Scripting Game Mechanics
  9. Basic AI and Enemy Behavior
  10. Revisiting Types, Methods, and Classes
  11. Introducing Stacks, Queues and HashSets
  12. Exploring Generics, Delegates, and Beyond
  13. The Journey Continues


From the Publisher

Harrison Ferrone learning c# unityHarrison Ferrone learning c# unity

Table of Contents

Getting to Know Your Environment

The Building Blocks of Programming

Diving into Variables, Types, and Methods

Control Flow and Collection Types

Working with Classes, Structs, and OOP

Getting Your Hands Dirty with Unity

Movement, Camera Controls, and Collisions

…and more

An interview with author Harrison Ferrone

What’s new in this fifth edition of Learning C# by Developing Games with Unity?

We’ve updated all project files for the new Unity 2020 release and added an extra chapter covering intermediate C# collection types, including Stacks, Queues, and HashSets.

How can this book help you learn C# and Unity?

The book is written with someone new to programming and Unity in mind, so we start from the very beginning and build up to more advanced topics. The book’s approach and structure focus on eliminating all assumptions about the reader, so we cover many topics that are left out by other instructional material that’s available.

c sharp game programming unityc sharp game programming unity

What was your objective in writing the book? And what are the key takeaways for readers?

My main objective for writing this book was to create a resource that I would have wanted when I started learning to program.

There are two key takeaways from this book: First, anyone can learn to program, and second, programming is a muscle – the only way to get better is to exercise it.

learning c# by developing games with unity 2020learning c# by developing games with unity 2020

What makes this book different from other ‘Learn C# with Unity’ books?

Many of the resources, tutorials, and textbooks that I used to learn how to program made assumptions about basic concepts that weren’t clearly fully explained, leading to hours of independent searches for answers.

I also wanted to write a book that stayed with the basics and didn’t try and throw too much at the reader. I’d say this focus leads to a much better end product and learning experience.







Publication Date

August 2020

July 2020

August 2020

June 2020

September 2020

Page Count






Learning Outcome

Get started with C# programming by understanding its fundamentals and learn how you can apply C# knowledge using game development examples in Unity

A project-based guide to get you up to speed with the specifics of VR development in Unity by building real-world projects that explore various core 3D development concepts

Learn tools and techniques in Unity to develop cross-platform mobile games and AR applications exploring the latest features of Unity 2020

Develop a solid understanding of the different tools in Unity and how to create impressive Unity applications by making the most of its toolset and while skills and aptitude required to pass the Unity Certification exam

Get up and running with Unity game development from ground up while creating several real-world projects to add to your professional game development portfolio.

Learning C# by developing games with Unity 2020 : an enjoyable and intuitive approach to getting started with C# programming and Unity Pdf Features



Title Page
Copyright and Credits
About Packt
Table of Contents
Chapter 1: Getting to Know Your Environment
Technical requirements
Getting started with Unity 2020
Using macOS
Creating a new project
Navigating the editor
Using C# with Unity
Working with C# scripts
Introducing the Visual Studio editor
Time for action – opening a C# file
Beware of naming mismatches
Syncing C# files
Exploring the documentation
Accessing Unity’s documentation
Time for action – opening the Reference Manual
Time for action – using the Scripting Reference
Locating C# resources
Time for action – looking up a C# class
Pop quiz – dealing with scripts
Chapter 2: The Building Blocks of Programming
Defining variables
Names are important
Variables act as placeholders
Time for action – creating a variable
Time for action – changing a variable’s value
Understanding methods
Methods drive actions
Methods are placeholders too
Time for action – creating a simple method
Introducing classes
A common Unity class
Classes are blueprints
Working with comments
Practical backslashes
Multi-line comments
Time for action – adding comments
Putting the building blocks together
Scripts become components
A helping hand from MonoBehavior
Hero’s trial – MonoBehavior in the Scripting API
Communication among classes
Pop quiz – C# building blocks
Chapter 3: Diving into Variables, Types, and Methods
Writing proper C#
Debugging your code
Declaring variables
Type and value declarations
Type-only declarations
Using access modifiers
Choosing a security level
Time for action – making a variable private
Working with types
Common built-in types
Time for action – playing with different types
Time for action – creating interpolated strings
Type conversions
Inferred declarations
Custom types
Types roundup
Naming variables
Best practices
Understanding variable scope
Introducing operators
Arithmetic and assignments
Time for action – executing incorrect type operations
Defining methods
Basic syntax
Modifiers and parameters
Time for action – defining a simple method
Naming conventions
Methods are logic detours
Specifying parameters
Time for action – adding method parameters
Specifying return values
Time for action – adding a return type
Using return values
Time for action – capturing return values
Hero’s trial – methods as arguments
Dissecting common Unity methods
The Start method
The Update method
Pop quiz – variables and methods
Chapter 4: Control Flow and Collection Types
Selection statements
The if-else statement
Basic syntax
Time for action – thieving prospects
Using the NOT operator
Nesting statements
Evaluating multiple conditions
Time for action – reaching the treasure
The switch statement
Basic syntax
Pattern matching
Time for action – choosing an action
Fall-through cases
Time for action – rolling the dice
Pop quiz 1 – if, and, or but
Collections at a glance
Basic syntax
Indexing and subscripts
Range exceptions
Basic syntax
Time for action – party members
Common methods
Basic syntax
Time for action – setting up an inventory
Working with dictionary pairs
Pop quiz 2 – all about collections
Iteration statements
For loops
Time for action – finding an element
foreach loops
Looping through key-value pairs
Hero’s trial – finding affordable items
while loops
Time for action – tracking player lives
To infinity and beyond
Chapter 5: Working with Classes, Structs, and OOP
Defining a class
Basic syntax
Time for action – creating a character class
Instantiating class objects
Time for action – creating a new character
Adding class fields
Time for action – fleshing out character details
Using constructors
Time for action – specifying starting properties
Declaring class methods
Time for action – printing out character data
Declaring structs
Basic syntax
Time for action – creating a weapon struct
Understanding reference and value types
Reference types
Time for action – creating a new hero
Value types
Time for action – copying weapons
Integrating the object-oriented mindset
Time for action – adding a reset
Base constructors
Time for action – calling a base constructor
Time for action – functional variations
OOP roundup
Applying OOP in Unity
Objects are a class act
Accessing components
Basic syntax
Time for action – accessing the current transform component
Time for action – finding components on different objects
Drag and drop
Time for action – assigning variables in Unity
Pop quiz – all things OOP
Chapter 6: Getting Your Hands Dirty with Unity
A game design primer
Game design documents
The Hero Born one-page
Building a level
Creating primitives
Time for action – creating a ground plane
Thinking in 3D
Time for action – changing the ground color
Editor tools
Hero’s trial – putting up drywall
Keeping the hierarchy clean
Time for action – using empty objects
Working with prefabs
Time for action – creating a turret
Time for action – updating the prefab
Time for action – finishing the level
Hero’s trial – creating a health pickup
Lighting basics
Creating lights
Light component properties
Animating in Unity
Creating clips
Time for action – creating a new clip
Recording keyframes
Time for action – spinning animation
Curves and tangents
Time for action – smoothing the spin
The particle system
Time for action – adding sparkle effects
Pop quiz – basic Unity features
Chapter 7: Movement, Camera Controls, and Collisions
Moving the player
Player setup
Time for action – creating the player capsule
Understanding vectors
Getting player input
Time for action – player locomotion
Adding a following Camera
Time for action – scripting camera behavior
Working with Unity physics
Rigidbody components in motion
Time for action – accessing the Rigidbody component
Time for action – moving the Rigidbody component
Colliders and collisions
Time for action – picking up an item
Using Collider triggers
Time for action – creating an enemy
Time for action – capturing trigger events
Hero’s trial – all the prefabs!
Physics roundup
Pop quiz – player controls and physics
Chapter 8: Scripting Game Mechanics
Adding jumps
Introducing enumerations
Underlying types
Time for action – pressing the spacebar to jump!
Working with layer masks
Time for action – setting object layers
Time for action – one jump at a time
Shooting projectiles
Instantiating objects
Time for action – creating a projectile prefab
Time for action – adding the shooting mechanic
Managing GameObject buildup
Time for action – destroying bullets
Creating a game manager
Tracking player properties
Time for action – creating a game manager
The get and set properties
Time for action – adding backing variables
Time for action – updating item collection
Adding player polish
Graphical UI
Time for action – adding UI elements
Win and loss conditions
Time for action – winning the game
Using directives and namespaces
Time for action – pausing and restarting
Pop quiz – working with mechanics
Chapter 9: Basic AI and Enemy Behavior
Navigating in Unity
Navigation components
Time for action – setting up the NavMesh
Time for action – setting up enemy agents
Moving enemy agents
Procedural programming
Time for action – referencing the patrol locations
Time for action – moving the enemy
Time for action – patrolling continuously between locations
Enemy game mechanics
Seek and destroy
Time for action – changing the agent’s destination
Time for action – lowering player health
Time for action – detecting bullet collisions
Time for action – updating the game manager
Refactoring and keeping it DRY
Time for action – creating a restart method
Hero’s trial – refactoring win/lose logic
Pop quiz – AI and navigation
Chapter 10: Revisiting Types, Methods, and Classes
Access Modifier redux
Constant and read-only properties
Using the static keyword
Time for action – creating a static class
Methods redux
Overloading methods
Time for action – overloading the level restart
Ref parameters
Time for action – tracking player restarts
Out parameters
OOP redux
Time for action – creating a manager interface
Time for action – adopting an interface
Abstract classes
Class extensions
Time for action – extending the string class
Time for action – using an extension method
Namespace redux
Type aliasing
Pop quiz – leveling up
Chapter 11: Introducing Stacks, Queues, and HashSets
Introducing stacks
Basic syntax
Time for action – storing collected items
Popping and peeking
Time for action – the last item collected
Common methods
Working with queues
Basic syntax
Adding, removing, and peeking
Common methods
Using HashSets
Basic syntax
Performing operations
Pop quiz – intermediate collections
Chapter 12: Exploring Generics, Delegates, and Beyond
Introducing generics
Generic objects
Time for action – creating a generic collection
Generic methods
Time for action – adding a generic item
Constraining type parameters
Time for action – limiting generic elements
Delegating actions
Basic syntax
Time for action – creating a debug delegate
Delegates as parameter types
Time for action – using a delegate argument
Firing events
Basic syntax
Time for action – creating an event
Handling event subscriptions
Time for action – subscribing to an event
Handling exceptions
Throwing exceptions
Time for action – checking negative scene indexes
Using try-catch
Time for action – catching restart errors
Design pattern primer
Common game patterns
Pop quiz – intermediate C#
Chapter 13: The Journey Continues
Scratching the surface
Remembering your object-oriented programming
Approaching Unity projects
Unity features we didn’t cover
Next steps
C# resources
Unity resources
Unity certifications
Hero’s trial – putting something out into the world
Pop Quiz Answers
Other Books You May Enjoy

Publisher‏:‎Packt Publishing (August 21, 2020)
Paperback‏:‎366 pages

Download Learning C# by Developing Games with Unity 2020 Pdf Free:

 NOTE: We do not own copyrights to these books. We’re sharing this material with our audience ONLY for educational purpose. We highly encourage our visitors to purchase original books from the respected publishers. If someone with copyrights wants us to remove this content, If you feel that we have violated your copyrights, then please contact us immediately. please contact us. or Email: [email protected]

Leave A Reply

Your email address will not be published.

19 − four =