Unity logo
Cancel
장바구니
애플리케이션
Sell Assets

평점 만점의 리뷰가 11,000개 이상

8만 5천명 이상의 리뷰

10만명 이상의 포럼 멤버가 선호하는 에셋

유니티에서 모더레이팅하는 모든 에셋

도구
유틸리티
This content is hosted by a third party provider that does not allow video views without acceptance of Targeting Cookies. Please set your cookie preferences for Targeting Cookies to yes if you wish to view videos from these providers.
1/5

Pub\Sub Messenger is a Lightweight, Open Source Library for Unity.

This library will provide a Pub\Sub Mechanism that is a part of SOLID principles in programming.


PROBLEMS IN GAMES

* Wiring the Parts with Events – Tightly Coupled and may cause Memory Leak problems. The Publisher and the Subscriber have to know of each other, and a Subscriber can’t be collected by the GC if it’s connected with the Publisher with strong event reference.

* Using Unity Event Routing – Although Unity Event Routing is a very good feature, it is a Unity Specific Solution and we need a generic one. Also, we cannot use it everywhere even if the project is in Unity.

* Dependency - In commonly used C# events or delegates, classes are “familiar” with each other and this prevents good modularity. This is NOT following SOLID Principles and Objects are not Encapsulated.


THE SOLUTION

* Pub\Sub Messenger - Container for Events that allows Decoupling of Publishers and Subscribers so they can evolve independently. This Decoupling is useful in Modularised Applications because new modules can be added that respond to events defined by the Shell or, more likely, other modules. All events have a Weak Reference and invocation can be done Async or Sync way.

* Payloads - Instead of passing objects or modules, pass small Payloads (Data/Messages) that are relevant for the specific cases/events.

* Encapsulation - Classes/Modules will not be “familiar” with each other, this will allow better encapsulation and less dependencies.

* Weak Reference - In case of subscriber’s destruction, it will be removed automatically from Messenger’s list, since it was referenced via Weak Reference.

* SOLID Principles - Pub/Sub can be a great pattern in combination with Dependency Injection (DP) and with Inversion of Control (IoC), both part of SOLID Principles.


Supported Platforms: Android, iOS, Windows, Mac, Linux, WebGL

Supported Unity Versions: 2017.x, 2018.x, 2019.x


Sources

* GitHub Project

* Youtube Clip

Pub-Sub Messenger

(7개)
43 users have favourite this asset
(43)
FREE
라이선스
파일 크기
1.1 MB
최신 버전
1.0.1
최신 릴리스 날짜
2021년 8월 17일
원본 Unity 버전
2020.3.5
Quality assets
Over 11,000 five-star assets
Trusted
Rated by 85,000+ customers
Community support
Supported by 100,000+ forum members
Unity logo
언어
어필리에이트 프로그램
멤버십링크 생성기어필리에이트 ID
Feedback
파트너 프로그램
협력사
USD
EUR
Copyright © 2025 Unity Technologies
모든 가격은 부가가치세를 제외한 금액입니다.
USD
EUR