返回排行榜

Habrador/Unity-Programming-Patterns

C#habrador.com/tutorials/programming-patterns/

Implementations of programming design patterns in Unity with examples in C# when to use them.

design-patternsobserver-patternstate-patternunityunity3dprototype-patternflyweight-patterntype-object-patternsubclass-sandbox-patternobject-poolobject-pool-patternspatial-partitioning
Star 增长趋势
Star
2.1k
Forks
271
周增长
Issues
2
1k2k
2020年6月2022年6月2024年7月2026年7月
README

# Game programming patterns in Unity

Here you can find a collection of programming (design) patterns in Unity, mainly from the book Game Programming Patterns. These are very useful to better organize your Unity project as it grows because they capture best practices and solutions to commonly occuring problems. You don't have to use them - you should see them as tools in your toolbox. You can also experiment with how they are implemented to fit your specific needs. Some patterns, such as Update, Game Loop, Component, are already built-in into Unity so you are already using them!

Programming patterns can be divided into the following groups:

  1. Architectural patterns. One example is the MVC (Model-View-Controller).
  2. Design patterns. Are more specific than architectural patterns, such as the Singleton.
  3. Anti-patterns. Are a collection of patterns programmers are using to solve problems even though they shouldn't use them because they are ineffective solutions. One example is a "God object," most likely called GameController where you collect everything you might need to make the game work. The problem with such as class is that it will grow in size, which will make it more difficult to maintain, and it will also be difficult to debug because the code doesn't belong together.

Patterns from the book Game Programming Patterns:

  1. Command
  2. Flyweight
  3. Observer
  4. Prototype
  5. Singleton
  6. State
  7. Double Buffer
  8. Game Loop
  9. Update Method
  10. Bytecode
  11. Subclass Sandbox
  12. Type Object
  13. Component
  14. Event Queue
  15. Service Locator
  16. Data Locality
  17. Dirty Flag
  18. Object Pool
  19. Spatial Partition

Other patterns:

  1. Decorator
  2. Factory
  3. Facade
  4. Template

Note that these are not all patterns out there. I recently read a book called "Machine Learning Design Patterns" which includes even more design patterns with a focus on machine learning problems. But I will continue adding patterns as I find them and if they are related to game development.

Sources and Read More

Special Thanks

相关仓库
donnemartin/system-design-primer

Learn how to design large-scale systems. Prep for the system design interview. Includes Anki flashcards.

PythonPyPIOtherprogrammingdevelopment
358.7k57.3k
iluwatar/java-design-patterns

Design patterns implemented in Java

JavaMavenOtherjavaprinciples
java-design-patterns.com
94.2k27.4k
binhnguyennus/awesome-scalability

The Patterns of Scalable, Reliable, and Performant Large-Scale Systems

MIT Licensesystem-designbackend
72.6k7k
DovAmir/awesome-design-patterns

A curated list of software and architecture related design patterns.

awesomeawesome-list
48.3k3.3k
nilbuild/design-patterns-for-humans

An ultra-simplified explanation to design patterns

design-patternsarchitecture
48k5.5k
kamranahmedse/design-patterns-for-humans

An ultra-simplified explanation to design patterns

design-patternsarchitecture
46.1k5.4k
faif/python-patterns

A collection of design patterns/idioms in Python

PythonPyPIpythonidioms
42.9k7k
tmrts/go-patterns

Curated list of Go design patterns, recipes and idioms

GoGo ModulesApache License 2.0goidioms
tmrts.com/go-patterns
28.1k2.3k
ashishps1/awesome-low-level-design

Learn Low Level Design (LLD) and prepare for interviews using free resources.

JavaMavenGNU General Public License v3.0awesomedesign-patterns
algomaster.io
25.5k6.2k
hollischuang/toBeTopJavaer

To Be Top Javaer - Java工程师成神之路

JavaMavenjavaprogrammer
hollischuang.com
25.4k5.4k
DesignPatternsPHP/DesignPatternsPHP

Sample code for several design patterns in PHP 8.x

PHPPackagistMIT Licensedesignpatternsphpphp
22.2k4.5k
inancgumus/learngo

❤️ 1000+ Hand-Crafted Go Examples, Exercises, and Quizzes. 🚀 Learn Go by fixing 1000+ tiny programs.

GoGo ModulesOthergolanggo
twitter.com/inancgumus
20.1k2.7k