Publisher | Unity Technologies |
---|---|
File size | 30.95MB |
Number of files | 903 |
Latest version | 1 |
Latest release date | 2024-07-22 02:05:11 |
First release date | 2024-07-22 02:05:11 |
Supported Unity versions | 2018.4.2 or higher |
We created this collection of samples to demonstrate how you can implement some of the common design patterns and principles from object-oriented programming, such as SOLID and KISS, into your Unity game development.
A companion resource to the project, the e-book Level up your code with game programming patterns, provides an in-depth explanation of each of the patterns implemented in the samples.
By implementing some of the techniques and game programming design patterns from the samples and e-book in your Unity project, you can more efficiently build and maintain a clean, organized, and readable codebase, which in turn, creates a solid foundation for scaling your game, development team, and business.
Here’s a rundown of the patterns included in the project:
SOLID Principles:
- Single-responsibility principle
- Open-closed principle
- Liskov substitution
- Interface segregation
- Dependency inversion
Design Patterns:
- Factory pattern
- Object pooling
- MVP
- MVVM
- Singleton
- Strategy
- Command
- Flyweight
- State
- Dirty flag
- Observer
Download the full e-book here and learn more in the following articles:
- Create modular and maintainable code with the Observer pattern
- Develop a modular, flexible codebase with the State programming pattern
- Use object pooling to boost performance of C# scripts in Unity
- Build a modular codebase with MVC and MVP programming patterns
- How to use the factory pattern for object creation at runtime
- Use the command pattern for flexible and extensible game systems
Note: This project requires Unity 6 preview (6000.0.5f1 or newer) and is an updated version of our original samples available on Github
Please keep in mind that the guide and these examples are based on subjective opinion; they are not recommendations that promise a particular outcome, but are examples only. A good code architectural solution is one that fits your needs and covers the majority of the day-to-day use cases in your game development. Our intention is for you to use the guide and examples as a starting point for creating your own guidelines.