Singleton Pattern
A singleton is a design pattern where a class has exactly one instance, and that instance is accessible globally. Instead of creating objects yourself, you ask for “the one” that already exists.
In game development, singletons are common for managers — audio, input, pooling. You don’t want two audio systems fighting over the speakers.
The tradeoff: global access is convenient but creates hidden dependencies. If everything talks to a singleton, it becomes hard to test or replace. Use it when “there should only be one” is a real constraint, not just convenience.
In Unreal Engine, World Subsystems are essentially engine-managed singletons scoped to a world. The engine handles creation and destruction, which avoids many of the classic singleton pitfalls.
Further Reading
- Robert Nystrom, Game Programming Patterns — Singleton chapter (gameprogrammingpatterns.com)
- Design Patterns: Elements of Reusable Object-Oriented Software (Gamma et al.) — the original Gang of Four book where the pattern was formalized