Advanced programming techniques
As part of this chapter, we will 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 GameObjects to the scene.
Note
Some of the scripts created in the following sections will only be for example purposes and will not be implemented in our game. However, it is recommended that you follow along. Any scripts that will be needed for our game will be readdressed in the Adding NPCs and A Conversation System section.
Singletons and managers
Any project of a sufficient size and complexity is going to run into issues related to managing your GameObjects 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...