{"id":13656308,"url":"https://github.com/QianMo/Unity-Design-Pattern","last_synced_at":"2025-04-23T22:30:39.269Z","repository":{"id":37432419,"uuid":"70555871","full_name":"QianMo/Unity-Design-Pattern","owner":"QianMo","description":":tea:  All Gang of Four Design Patterns written in Unity C# with many examples. And some Game Programming Patterns  written in Unity C#. | 各种设计模式的Unity3D C#版本实现","archived":false,"fork":false,"pushed_at":"2020-02-06T05:00:57.000Z","size":4109,"stargazers_count":4395,"open_issues_count":5,"forks_count":1022,"subscribers_count":189,"default_branch":"master","last_synced_at":"2025-04-13T20:39:33.084Z","etag":null,"topics":["bridge-pattern","command-pattern","csharp-design-patterns","csharp-resources","design-pattern","design-patterns","facade-pattern","factory-pattern","game-development","game-programming","game-programming-pattern","iterator-pattern","mediator-pattern","memento-pattern","pool-pattern","singleton-pattern","unity","unity-design-pattern","unity3d","visitor-pattern"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/QianMo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-11T04:26:01.000Z","updated_at":"2025-04-13T01:49:52.000Z","dependencies_parsed_at":"2022-07-07T12:44:33.263Z","dependency_job_id":null,"html_url":"https://github.com/QianMo/Unity-Design-Pattern","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QianMo%2FUnity-Design-Pattern","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QianMo%2FUnity-Design-Pattern/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QianMo%2FUnity-Design-Pattern/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QianMo%2FUnity-Design-Pattern/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/QianMo","download_url":"https://codeload.github.com/QianMo/Unity-Design-Pattern/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250526324,"owners_count":21445161,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bridge-pattern","command-pattern","csharp-design-patterns","csharp-resources","design-pattern","design-patterns","facade-pattern","factory-pattern","game-development","game-programming","game-programming-pattern","iterator-pattern","mediator-pattern","memento-pattern","pool-pattern","singleton-pattern","unity","unity-design-pattern","unity3d","visitor-pattern"],"created_at":"2024-08-02T05:00:18.149Z","updated_at":"2025-04-23T22:30:38.724Z","avatar_url":"https://github.com/QianMo.png","language":"C#","readme":"![](Media/repo-cover.jpg)\n\n# Design Patterns Written in Unity3D\nThis repository is about cool design patterns written in Unity3D C#. \n* Now 23 [Gang of Four Patterns] have all been finished in Unity3D in this repository.\n* Each pattern contains the corresponding structure implementations, application examples and diagrams. Same way with [Naphier/unity-design-patterns], in this repository each pattern is contained in a separate folder. Inside these are a folder (\"Structure\") to show what classes are used in the pattern's structure in Unity3D(with a scene) and a folder or folders (\"Example\") showing one or more real-world example of using the pattern in Unity3D along with a scene showing it in action. Each pattern folder may contain one or more Example.\n* Game design patterns from book [Game Programming Patterns] have been partially implemented.\n\n此repo为Unity3D中各种设计模式的实践与运用。\n* 目前已经在Unity中实现了《[设计模式:可复用面向对象软件的基础]》一书中提出的23种设计模式。\n* 每种模式都包含对应的结构实现、应用示例以及图示介绍。类似[Naphier/unity-design-patterns]的结构，此repo中的每种模式用单独的文件夹分开。每种模式对应的文件夹中包含了名为“Structure”的子文件夹，里面存放的是此模式在Unity中的使用代码的基本框架实现，而另外包含的Example子文件夹中存放的是此模式在Unity中使用的实际示例。每种框架实现或实例示例实现都包含对应的场景，每种模式文件夹中可能包含一个或者多个Example。\n* 《[游戏编程模式]》一书中介绍的常用游戏设计模式的Unity版实现也有部分实现。\n\n# Contents\n## I、Gang of Four Patterns in Unity （23种GOF设计模式的Unity实现）\n### Behavioral Patterns 行为型模式\n* [Command Pattern 命令模式]\n* [State Pattern 状态模式]\n* [Observer Pattern 观察者模式]\n* [Chain of Responsibility Pattern 责任链模式]\n* [Mediator Pattern 中介者模式]\n* [Interpreter Pattern 解释器模式]\n* [Iterator Pattern 迭代器模式]\n* [Memento Pattern 备忘录模式]\n* [Strategy Pattern 策略模式]\n* [Template Method Pattern 模板方法模式]\n* [Visitor Pattern 访问者模式]\n\n\n### Structural Patterns 结构型模式\n* [Adapter Pattern 适配器模式]\n* [Bridge Pattern 桥接模式]\n* [Composite Pattern 组合模式]\n* [Decorator Pattern 装饰模式]\n* [Facade Pattern 外观模式]\n* [Flyweight Pattern 享元模式]\n* [Proxy Pattern 代理模式]\n\n\n### Creational Patterns 创建型模式\n* [Prototype Pattern 原型模式]\n* [Singleton Pattern 单例模式]\n* [Abstract Factory Pattern 抽象工厂模式]\n* [Builder Pattern 建造者模式]\n* [Factory Method Pattern 工厂方法模式]\n\n\u003cbr\u003e \n\n## II、Game Programming Patterns in Unity （《游戏编程模式》的Unity实现）\n* [Subclass Sandbox Pattern 子类沙盒模式]\n* [Type Object Pattern 类型对象模式]\n* [Component Pattern 组件模式]\n* [Event Queue Pattern 事件队列模式]\n* [Game Loop Pattern 游戏循环模式]\n* [Service Locator Pattern 服务定位器模式]\n* [Data Locality Pattern 数据局部性模式]\n* [Dirty Flag Pattern 脏标记模式]\n* [Object Pool Pattern 对象池模式]\n\u003cbr\u003e \n\n# Reference resources(参考)\n\n* http://gameprogrammingpatterns.com/\n* https://www.youtube.com/playlist?list=PLF206E906175C7E07\n* https://github.com/Naphier/unity-design-patterns\n* http://www.dofactory.com/net/design-patterns\n* https://sourcemaking.com/design_patterns\n* http://www.habrador.com/tutorials/programming-patterns/\n* [Gang of Four Patterns]\n* [Head First Design Patterns]\n* [设计模式与游戏完美开发]\n\n[State Pattern 状态模式]:https://github.com/QianMo/Unity3D-Design-Patterns/tree/master/Assets/Behavioral%20Patterns/State%20Pattern\n[Command Pattern 命令模式]: https://github.com/QianMo/Unity-Design-Pattern/tree/master/Assets/Behavioral%20Patterns/Command%20Pattern\n[Observer Pattern 观察者模式]:https://github.com/QianMo/Unity-Design-Pattern/tree/master/Assets/Behavioral%20Patterns/Observer%20Pattern\n[Chain of Responsibility Pattern 责任链模式]:https://github.com/QianMo/Unity-Design-Pattern/tree/master/Assets/Behavioral%20Patterns/Chain%20of%20Responsibility%20Pattern\n[Mediator Pattern 中介者模式]:https://github.com/QianMo/Unity-Design-Pattern/tree/master/Assets/Behavioral%20Patterns/Mediator%20Pattern\n[Interpreter Pattern 解释器模式]:https://github.com/QianMo/Unity-Design-Pattern/tree/master/Assets/Behavioral%20Patterns/Interpreter%20Pattern\n[Iterator Pattern 迭代器模式]:https://github.com/QianMo/Unity-Design-Pattern/tree/master/Assets/Behavioral%20Patterns/Iterator%20Pattern\n[Memento Pattern 备忘录模式]:https://github.com/QianMo/Unity-Design-Pattern/tree/master/Assets/Behavioral%20Patterns/Memento%20Pattern\n[Strategy Pattern 策略模式]:https://github.com/QianMo/Unity-Design-Pattern/tree/master/Assets/Behavioral%20Patterns/Strategy%20Pattern\n[Template Method Pattern 模板方法模式]:https://github.com/QianMo/Unity-Design-Pattern/tree/master/Assets/Behavioral%20Patterns/Template%20Method%20Pattern\n[Visitor Pattern 访问者模式]:https://github.com/QianMo/Unity-Design-Pattern/tree/master/Assets/Behavioral%20Patterns/Visitor%20Pattern\n[Adapter Pattern 适配器模式]:https://github.com/QianMo/Unity-Design-Pattern/tree/master/Assets/Structural%20Patterns/Adapter%20Pattern\n[Bridge Pattern 桥接模式]:https://github.com/QianMo/Unity-Design-Pattern/tree/master/Assets/Structural%20Patterns/Bridge%20Pattern\n[Composite Pattern 组合模式]:https://github.com/QianMo/Unity-Design-Pattern/tree/master/Assets/Structural%20Patterns/Composite%20Pattern\n[Decorator Pattern 装饰模式]:https://github.com/QianMo/Unity-Design-Pattern/tree/master/Assets/Structural%20Patterns/Decorator%20Pattern\n[Facade Pattern 外观模式]:https://github.com/QianMo/Unity-Design-Pattern/tree/master/Assets/Structural%20Patterns/Facade%20Pattern\n[Flyweight Pattern 享元模式]:https://github.com/QianMo/Unity-Design-Pattern/tree/master/Assets/Structural%20Patterns/Flyweight%20Pattern\n[Proxy Pattern 代理模式]:https://github.com/QianMo/Unity-Design-Pattern/tree/master/Assets/Structural%20Patterns/Proxy%20Pattern\n[Abstract Factory Pattern 抽象工厂模式]:https://github.com/QianMo/Unity-Design-Pattern/tree/master/Assets/Creational%20Patterns/Abstract%20Factory%20Pattern\n[Builder Pattern 建造者模式]:https://github.com/QianMo/Unity-Design-Pattern/tree/master/Assets/Creational%20Patterns/Builder%20Pattern\n[Factory Method Pattern 工厂方法模式]:https://github.com/QianMo/Unity-Design-Pattern/tree/master/Assets/Creational%20Patterns/Factory%20Method%20Pattern\n[Prototype Pattern 原型模式]:https://github.com/QianMo/Unity-Design-Pattern/tree/master/Assets/Creational%20Patterns/Prototype%20Pattern\n[Singleton Pattern 单例模式]:https://github.com/QianMo/Unity-Design-Pattern/tree/master/Assets/Creational%20Patterns/Singleton%20Pattern\n\n[Subclass Sandbox Pattern 子类沙盒模式]:https://github.com/QianMo/Unity-Design-Pattern/tree/master/Assets/Game%20Programming%20Patterns/SubclassSandbox%20Pattern\n[Type Object Pattern 类型对象模式]:https://github.com/QianMo/Unity-Design-Pattern/tree/master/Assets/Game%20Programming%20Patterns/Type%20Object%20Pattern\n[Component Pattern 组件模式]:https://github.com/QianMo/Unity-Design-Pattern/tree/master/Assets/Game%20Programming%20Patterns/Component%20Pattern\n[Event Queue Pattern 事件队列模式]:https://github.com/QianMo/Unity-Design-Pattern/tree/master/Assets/Game%20Programming%20Patterns/Event%20Queue%20Pattern\n[Game Loop Pattern 游戏循环模式]:https://github.com/QianMo/Unity-Design-Pattern/tree/master/Assets/Game%20Programming%20Patterns/Game%20Loop%20Pattern\n[Service Locator Pattern 服务定位器模式]:\nhttps://github.com/QianMo/Unity-Design-Pattern/tree/master/Assets/Game%20Programming%20Patterns/Service%20Locator%20Pattern\n[Data Locality Pattern 数据局部性模式]:\nhttps://github.com/QianMo/Unity-Design-Pattern/tree/master/Assets/Game%20Programming%20Patterns/Data%20Locality%20Pattern\n[Dirty Flag Pattern 脏标记模式]:\nhttps://github.com/QianMo/Unity-Design-Pattern/tree/master/Assets/Game%20Programming%20Patterns/Dirty%20Flag%20Pattern\n[Object Pool Pattern 对象池模式]:\nhttps://github.com/QianMo/Unity-Design-Pattern/tree/master/Assets/Game%20Programming%20Patterns/Object%20Pool%20Pattern\n\n\n\n[Gang of Four Patterns]:https://www.amazon.com/Design-Patterns-Elements-Reusable-Object-Oriented/dp/0201633612/ref=sr_1_1?ie=UTF8\u0026qid=1476338345\u0026sr=8-1\u0026keywords=design+patterns\n[Game Programming Patterns]:http://gameprogrammingpatterns.com/\n[设计模式:可复用面向对象软件的基础]:https://www.amazon.cn/%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%A7%91%E5%AD%A6%E4%B8%9B%E4%B9%A6-%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F-%E5%8F%AF%E5%A4%8D%E7%94%A8%E9%9D%A2%E5%90%91%E5%AF%B9%E8%B1%A1%E8%BD%AF%E4%BB%B6%E7%9A%84%E5%9F%BA%E7%A1%80-Erich-Gamma/dp/B001130JN8/ref=sr_1_1?ie=UTF8\u0026qid=1476338390\u0026sr=8-1\u0026keywords=%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F\n[游戏编程模式]:http://gameprogrammingpatterns.com/\n[Head First Design Patterns]:https://www.amazon.com/dp/0596007124//ref=cm_sw_su_dp?tag=nethta-20\n[Naphier/unity-design-patterns]:https://github.com/Naphier/unity-design-patterns\n[设计模式与游戏完美开发]:https://www.amazon.cn/dp/B01N9GO0ZC\n","funding_links":[],"categories":["C\\#","C# #","Guides","Sample Project"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FQianMo%2FUnity-Design-Pattern","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FQianMo%2FUnity-Design-Pattern","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FQianMo%2FUnity-Design-Pattern/lists"}