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

Events


Game worlds are fully deterministic systems; in Unity, the scene represents a shared 3D Cartesian space and timeline inside which finite GameObjects exist. Things only happen within this space when the game logic and code permits them to. For example, objects can only move when there is code somewhere that tells them to do so, and under specific conditions, such as when the player presses specific buttons on the keyboard. Notice from the example that behaviors are not simply random but are interconnected; objects move only when keyboard events occur. There is an important connection established between the actions, where one action entails another. These connections or linkages are referred to as events; each unique connection being a single event. Events are not active but passive; they represent moments of opportunity but not action in themselves, such as a key press, a mouse click, an object entering a collider volume, the player being attacked, and so on. These are examples of...