Book Image

Mastering Unity Scripting

By : Alan Thorn
Book Image

Mastering Unity Scripting

By: Alan Thorn

Overview of this book

Table of Contents (17 chapters)
Mastering Unity Scripting
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

The GameObject


The GameObject is, in many senses, the fundamental unit or entity inside a scene. It corresponds most naturally to what we'd call a thing in the everyday sense. It doesn't really matter what kind of context-specific behaviors or things you'll actually need inside your own games, because in all cases, you'll need GameObjects to implement them. GameObjects don't need to be visible to the gamer; they can be, and often are, invisible. Sounds, colliders, and manager classes are some examples of invisible GameObjects. On the other hand, many GameObjects will be visible: meshes, animated meshes, sprites, and so on. In all cases, however, whether visible or invisible, the GameObject is instantiated inside a scene as a collection of related components. A component is essentially a class derived from MonoBehaviour, and it can be attached to a GameObject in the scene to change its behavior. Every GameObject has at least one minimal component in common, and it's impossible to remove it...