Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering Unity 2D game development

You're reading from   Mastering Unity 2D game development Mastering Unity 2D Game Development will give your game development skills a boost and help you begin creating and building an RPG with Unity 2D game framework

Arrow left icon
Product type Paperback
Published in Aug 2014
Publisher
ISBN-13 9781849697347
Length 474 pages
Edition 1st Edition
Tools
Arrow right icon
Author (1):
Arrow left icon
Simon Jackson Simon Jackson
Author Profile Icon Simon Jackson
Simon Jackson
Arrow right icon
View More author details
Toc

Table of Contents (15) Chapters Close

Preface 1. Overview 2. Building a Character FREE CHAPTER 3. Getting Animated 4. The Game World 5. NPCs and Interactions 6. The Big Wild World 7. Encountering Enemies and Running Away 8. Shopping for Weapons 9. Getting Ready to Fight 10. Fight and Gain XP 11. Onward Wary Traveler 12. Deployment and Beyond A. Additional Resources Index

Advanced programming techniques

As part of this chapter, we start to go in depth with some advanced programming techniques. These enable us to structure our code better and add management to our game project instead of just adding game objects to the scene.

Singletons and managers

Any project of a sufficient size and complexity is going to run into issues related to managing your game objects as and when they are added and removed from a scene. If you don't get your design right from the start, you are setting yourself up for a world of mess later. A common way to handle this is to use one of the three patterns, single instance managers, singletons, or a dependency system, to manage these controllers for you.

There are two main ways through which you can implement the singleton pattern in Unity. The first way is to use a public static parameter within a class to maintain the runtime class. This also allows any other script to access it from anywhere in the game and is useful if you want...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at £16.99/month. Cancel anytime