Chapter 26
Classes
A class is a collection of both variables and functions in a single C# object. Classes are an essential building block in modern games and, more widely, in Object-Oriented Programming. By the end of this chapter, you will understand how to create and use classes and their importance in Unity game development.
Understanding Classes
Classes combine functionality and data. Another way to put this is that classes are composed of both functions and variables (which when used within a class are called methods and fields, respectively). Classes are often used to represent objects in the world of your game project. For example, consider a character in a standard roleplaying game. There are several fields (or variables) that she might ...
Get Introduction to Game Design, Prototyping, and Development now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.