Learning C# by Developing Games with Unity 2019
eBook - ePub

Learning C# by Developing Games with Unity 2019

Code in C# and build 3D games with Unity, 4th Edition

Harrison Ferrone

Share book
  1. 342 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Learning C# by Developing Games with Unity 2019

Code in C# and build 3D games with Unity, 4th Edition

Harrison Ferrone

Book details
Book preview
Table of contents
Citations

About This Book

Understand the fundamentals of C# programming and get started with coding from ground up in an engaging and practical manner

Key Features

  • Beginner's guide to getting started with software development concepts from a macro level
  • Leverage the power of the latest C# in solving the complex programming problems
  • Learn to script and customize your 3D games and implement animation techniques to make them engaging

Book Description

Learning to program in today's technical landscape can be a daunting task, especially when faced with the sheer number of languages you have to choose from. Luckily, Learning C# with Unity 2019 removes the guesswork and starts you off on the path to becoming a confident, and competent, programmer using game development with Unity.

You'll start off small by learning the building blocks of programming, from variables, methods, and conditional statements to classes and object-oriented systems. After you have the basics under your belt you'll explore the Unity interface, creating C# scripts, and translating your newfound knowledge into simple game mechanics.

Throughout this journey, you'll get hands-on experience with programming best practices and macro-level topics such as manager classes and flexible application architecture. By the end of the book, you'll be familiar with intermediate C# topics like generics, delegates, and events, setting you up to take on projects of your own.

What you will learn

  • Understand programming fundamentals with practice examples in C#
  • Explore the interface and features of Unity 2019
  • Learn C# programming syntax from scratch
  • Create a game design document and prototype level
  • Explore intermediate programming topics and best practices
  • Implement game mechanics, interactions, and UI elements with C#

Who this book is for

The book caters to developers and programmers who want to get started with C# programming in a fun and engaging manner. Anyone who wants to build games and script in C# language and Unity can take this book up. No prior programming or Unity experience is required.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Learning C# by Developing Games with Unity 2019 an online PDF/ePUB?
Yes, you can access Learning C# by Developing Games with Unity 2019 by Harrison Ferrone in PDF and/or ePUB format, as well as other popular books in Computer Science & Programming Games. We have over one million books available in our catalogue for you to explore.

Information

Year
2019
ISBN
9781789536942
Edition
4
Section 1: Programming Foundations and C#
This section will introduce you to the Unity development environment, the fundamentals of programming, and the C# language from the ground up. By the end of this section, you'll know your way around Unity and have the foundational knowledge necessary to start creating a simple game.
The following chapters will be covered in this section:
  • Chapter 1, Getting to Know Your Environment
  • Chapter 2, The Building Blocks of Programming
  • Chapter 3, Diving into Variables, Types, and Methods
  • Chapter 4, Control Flow and Collection Types
  • Chapter 5, Working with Classes, Structs, and OOP
Getting to Know your Environment
Pop culture has taught us that computer programmers are usually outsiders, lone wolves, or geeky hackers who possess extraordinary mental gifts for algorithmic thought, little social IQ, and the odd anarchic bent. While this is definitely not the case, in reality, 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 will quickly adapt to this new way of thinking, and maybe even come to enjoy it.
You already use analytical skills in your everyday life that 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 left, right, then left again like the rest of us. That's evaluating different conditions or what we call control flow. When you look at a can of pop, you instinctively identify that it has properties, such as shape, weight, and contents. That's a class object. You get the idea.
We're going to begin our adventure into C# programming by covering the following topics:
  • Basic prerequisites
  • Starting out with Unity
  • Using C# with Unity
  • Working with the Visual Studio editor
  • Accessing documentation and resources

Some basic prerequisites

Sometimes it's easier to start with what a thing isn't, rather than what it is. The main goal of this book isn't to learn the vast ins and outs of Unity or all of game development. By necessity, we'll cover these topics at a basic level, and in more detail in Chapter 6, Getting Your Hands Dirty with Unity, but their purpose is to provide a fun, accessible way for us to learn the C# programming language from the ground up.
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 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.

Starting out with Unity 2019

Head over to https://store.unity.com/ and you'll see a few options. Don't get overwhelmed—you can get Unity completely free by selecting the personal option on the right. The other paid options offer more advanced functionality and services, but you can check these out on your own down the road:
After selecting the personal plan, you'll end up on the download screen; accept the terms and conditions and hit Download Installer for Mac OS X:
If you're using a Windows machine, select the Choose Windows link located underneath the installer button, accept the terms and conditions, and you're good to go!
You can also download and manage different versions of Unity through the Unity Hub application, which can be also be downloaded from this screen.
When the download is complete, open up the package (by double-clicking it) and follow the installation instructions. When you get the green light, go ahead and fire up Unity!
All of the examples and screenshots for this book were created and captured using Unity 2018.3.8f1 and verified with version 2019.2.0a7. If you're using a newer version, things might look slightly different in the editor, but following along won't be a problem.

Creating a new project

The first thing you'll see whenUnityfinishes thinking aboutopeningis the dashboard. If you have a Unity account, go ahead andSign in. If not, you can either create one or hitSkipat the bottom of the screen.
Now, let's set up a new project by selecting the New tab at the top right and setting the following fields:
  • Project Name: I'll be calling mine Hero Born
  • Location:Wherever you'd like the project to be saved
  • Template: Make sure this is set to 3Dand hit Create Project:

Navigating the editor

When the new project finishes initializing, you'll see the glorious Unity editor! I've marked the important tabs (or panels, if you prefer) in the following screenshot, which we can break down as follows:
  • The Toolbaris the topmost part of the Unity editor. From here, you can manipulate objects (far-left button group), and play and pause the game (center buttons). The rightmost button group contains Unity Services, layer masks, ...

Table of contents