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

You're reading from   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

Arrow left icon
Product type Paperback
Published in Nov 2022
Publisher Packt
ISBN-13 9781837636877
Length 466 pages
Edition 7th Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Harrison Ferrone Harrison Ferrone
Author Profile Icon Harrison Ferrone
Harrison Ferrone
Arrow right icon
View More author details
Toc

Table of Contents (18) Chapters Close

Preface 1. Getting to Know Your Environment FREE CHAPTER 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. Specialized Collection Types and LINQ 12. Saving, Loading, and Serializing Data 13. Exploring Generics, Delegates, and Beyond 14. The Journey Continues 15. Pop Quiz Answers
16. Other Books You May Enjoy
17. Index

What this book covers

Chapter 1, Getting to Know Your Environment, starts off with the Unity installation process, the main features of the editor, and finding documentation for C# and Unity-specific topics. We’ll also go through creating C# scripts from inside Unity and look at Visual Studio, the application where all our code editing takes place.

Chapter 2, The Building Blocks of Programming, begins by laying out the atomic-level concepts of programming, giving you the chance to relate variables, methods, and classes to situations in everyday life. From there, we move on to simple debugging techniques, proper formatting and commenting, and how Unity turns C# scripts into components.

Chapter 3, Diving into Variables, Types, and Methods, takes a deeper look at the building blocks from Chapter 2. This includes C# data types, naming conventions, access modifiers, and everything else you’ll need for the foundation of a program. We’ll also go over how to write methods, add parameters, and use return types, ending with an overview of standard Unity methods belonging to the MonoBehaviour class.

Chapter 4, Control Flow and Collection Types, introduces the common approaches to making decisions in code, consisting of the if...else and switch statements. From there, we move on to working with arrays, lists, and dictionaries, and incorporating iteration statements for looping through collection types. We end the chapter with a look at conditional looping statements and a special C# data type called enumerations.

Chapter 5, Working with Classes, Structs, and OOP, details our first contact with constructing and instantiating classes and structs. We’ll go through the basic steps of creating constructors, adding variables and methods, and the fundamentals of subclassing and inheritance. The chapter will end with a comprehensive explanation of object-oriented programming and how it applies to C#.

Chapter 6, Getting Your Hands Dirty with Unity, marks our departure from C# syntax into the world of game design, level building, and Unity’s featured tools. We’ll start by going over the basics of a game design document and then move on to blocking out our level geometry and adding lighting and a simple particle system.

Chapter 7, Movement, Camera Controls, and Collisions, explains different approaches to moving a player object and setting up a third-person camera. We’ll discuss incorporating Unity physics for more realistic locomotion effects, as well as how to work with collider components and capture interactions within a scene.

Chapter 8, Scripting Game Mechanics, introduces the concept of game mechanics and how to effectively implement them. We’ll start by adding a simple jump action, create a shooting mechanic, and build on the previous chapters’ code by adding logic to handle item collection.

Chapter 9, Basic AI and Enemy Behavior, starts with a brief overview of artificial intelligence in games and the concepts we will be applying to Hero Born. Topics covered in this chapter will include navigation in Unity, using the level geometry and a navigation mesh, smart agents, and automated enemy movement.

Chapter 10, Revisiting Types, Methods, and Classes, takes a more in-depth look at data types, intermediate method features, and additional behaviors that can be used for more complex classes. This chapter will give you a deeper understanding of the versatility and breadth of the C# language.

Chapter 11, Specialized Collection Types and LINQ, dives into Stacks, Queues, HashSets, and the different development scenarios that each is uniquely suited for. This chapter also explores filtering, ordering, and transforming data collections using LINQ.

Chapter 12, Saving, Loading, and Serializing Data, gets you ready to handle your game’s information. Topics covered in this chapter include working with the filesystem and creating deleting and updating files. We’ll also cover different data types including XML, JSON, binary data, and end with a practical discussion on serializing C# objects directly into data formats.

Chapter 13, Exploring Generics, Delegates, and Beyond, details intermediate features of the C# language and how to apply them in practical, real-world scenarios. We’ll start with an overview of generic programming and progress to concepts such as delegation, events, and exception handling.

Chapter 14, The Journey Continues, reviews the main topics you’ve learned throughout the book and leaves you with resources for further study in both C# and Unity. Included in these resources will be online reading material, certifications, and a host of my favorite video tutorial channels.

lock icon The rest of the chapter is locked
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