Another pivotal task in Unity involves searching for objects in the scene from script, especially if objects are instantiated at runtime. Tasks such as "get me the player object" and "get me all enemies in the scene" are important for many operations, from respawning enemies and power-ups to repositioning the player and checking collisions between objects. To retrieve references to specific GameObjects
, Unity offers a set of functions associated with the GameObject
class. These functions can be useful but expensive, so be sure to call them during one-off events, such as Start
and Awake
, wherever possible. Let's explore these further, in addition to other techniques and methods to work with found objects.
Mastering Unity Scripting
By :
Mastering Unity Scripting
By:
Overview of this book
Table of Contents (17 chapters)
Mastering Unity Scripting
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Free Chapter
Unity C# Refresher
Debugging
Singletons, Statics, GameObjects, and the World
Event-driven Programming
Cameras, Rendering, and Scenes
Working with Mono
Artificial Intelligence
Customizing the Unity Editor
Working with Textures, Models, and 2D
Source Control and Other Tips
Index
Customer Reviews