This repository is a collection of Design Patterns in Unity,written in C#.
Inclues:
- 23 Game of Four Patterns
- 《Game Programming Patterns》 in Unity
The beauty of design patterns is that they are a set of proven and practiced general solutions that can help software engineers improve the quality of their code and simplify the complexity of software development.
But the controversy about design patterns in recent years has also been endless.
The main reason is that the concept of design patterns has been proposed for nearly thirty years. With the development of modern software engineering, some situation has changed:
-
With the development of software engineering, the business split is finer, and the framework and business are often completely disassembled. Some reusable software has migrated to the underlying system/language as toolkits or frameworks—and mostly should be left to the experts.
-
Some design patterns are already integrated by languages or frameworks. It is more convenient to use these language support for developers who use them.
-
GOF did not sort the design patterns according to the frequency of use, which led to some misunderstandings.
But no matter what level of programmers, what type of code development, as long as we pursue code reusability, we need to practice the internal strength of design patterns.
I'm trying to illustrate Design Patterns in the field of Unity3D game development, Includes:
- According to my understanding, sort the design patterns in game development by importance.
- In addition to 23 design patterns, introduce the game design patterns from "Game Programming Patterns".
- For each design pattern, ideas and examples of using it in game development are provided, focusing on game development, with the purpose of deepening understanding and avoiding generalizations.
- For those patterns wildly used in framework (C#/.Net Frameworks/Unity3D) , focus on how the framework use the pattern. Talk about the understanding of design patterns through the source code in UnityCSReference.
- Engineers who have a basic understanding of Unity game development and want to improve code quality.
- Engineers who have a basic understanding of Unity game development and design patterns and want to review design patterns.
- junior programmers who are interested in game development and ready to dive deep in this field.
- Engineers who don't know anything about Unity3D game development, but are interested in design patterns and want to find design-patterns examples in game development.
- People who don't understand Unity development at all, and have never heard of design patterns. (It is recommended to learn Unity development and design patterns separately)
- Engineers who feel that design patterns are useless and enjoy shit code.
Examples that have been completed so far are:
-
Creational Patterns
-
Core
-
Peripheral
-
-
Structural Patterns
-
Behavioral design patterns
-
Core
-
Peripheral
- Chain Of Responsibility
- Interpreter
- Memento
- [] Visitor
-
-
《Game Programming Patterns》
- Chapter 2-Command(already mentioned)
- Chapter 3-Flyweight(already mentioned)
- Chapter 4-Observer(already mentioned)
- Chapter 5-Prototype(already mentioned)
- Chapter 6-Singleton(already mentioned)
- Chapter 7-State(already mentioned)
- Chapter 8-DoubleBuffer
- Chapter 9-GameLoop
- Chapter 12-SubclassSandbox
- Chapter 14-Component
- Chapter 15-EventQueue
- Chapter 16-ServiceLocator
- Chapter 17-DataLocality
- Chapter 18-DirtyFlag
- Chapter 19-ObjectPool
Visit专题 | Unity3D中的设计模式to see more
The code in Unity-Design-Pattern references part of the source code of:
A heartfelt thank you to them!
Unity-Design-Pattern is avaiable under the MIT license.
Unity-Design-Pattern references part of the source code of other projects, See License for the full license text.