Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Learning C# by Developing Games with Unity 6
  • Table Of Contents Toc
Learning C# by Developing Games with Unity 6

Learning C# by Developing Games with Unity 6 - Eighth Edition

By : Harrison Ferrone
5 (1)
close
close
Learning C# by Developing Games with Unity 6

Learning C# by Developing Games with Unity 6

5 (1)
By: Harrison Ferrone

Overview of this book

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 will help you as a new programmer! Harrison Ferrone, in this eighth edition of the bestselling series, will take you through the core concepts of programming and the C# language from scratch, while building an engaging and playable game prototype in Unity 6. You’ll get to grips with the fundamentals of object-oriented programming (OOP) and the Unity engine with lots of code samples, exercises, and tips to go beyond the book with your work. You’ll write C# scripts for simple game mechanics, perform procedural programming, request live data from the web, and add complexity to your games by introducing intelligent enemies and damage-dealing projectiles. You’ll also explore the underlying mechanics 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. You can easily reference color versions of images by downloading them from the GitHub repository or the graphics bundle linked in the book.
Table of Contents (20 chapters)
close
close
Preface
16
Unlock Your Book’s Exclusive Benefits
17
Pop Quiz Answers
18
Other Books You May Enjoy
19
Index

Understanding methods

In the previous chapter, we briefly touched on the role that methods play in our programs; namely, they store and execute instructions, just like variables store values. Now, we need to understand the syntax of method declarations and how they drive action and behavior in our classes.As with variables, method declarations have their basic requirements, which are as follows:

  • The type of data that will be returned by the method (methods don’t all have to return anything, so this can be void)
  • A unique name, starting with a capital letter
  • A pair of parentheses following the method name
  • A pair of curly brackets marking the method body (where instructions are stored)

Putting all of these rules together, we get a simple method blueprint:

returnType UniqueName() 
{ 
    method body 
}

Let’s break down the default Start() method in LearningCurve as a practical example:

void Start() 
{
}

In the preceding output, we can see the following:

  • The method starts...
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.
Learning C# by Developing Games with Unity 6
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist download Download options font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon