Creating object managers
Not every object in your Scene should be something that can be seen, heard, or collided with. Some objects can also exist with a conceptual meaning, not something tangible. For example, imagine you need to keep a count of the number of enemies: where do you save that? You also need some place to save the current score of the player, and you may be thinking it could be on the player itself, but what happens if the player dies and respawns?
The data would be lost! In such scenarios, the concept of a manager can be a useful way of solving this in our first games, so let’s explore it.
In this section, we are going to see the following object manager concepts:
- Sharing variables with the Singleton design pattern
- Sharing variables in Visual Scripting
- Creating managers
We will start by discussing what the Singleton design pattern is and how it helps us simplify the communication of objects. With it, we will create...