{"repo":"PeturDarri/GenericEventBus","free":true,"listed":false,"github":"https://github.com/PeturDarri/GenericEventBus","clone":"git clone https://github.com/PeturDarri/GenericEventBus.git","description":"A synchronous event bus for Unity, using strictly typed events and generics to reduce runtime overhead.","language":"C#","stars":118,"topics":["event-bus","eventbus","unity","upm","upm-package"],"license":"MIT","category":"game-templates","readme_excerpt":"Generic Event Bus A synchronous event bus for Unity written in C#, using strictly typed events and generics to reduce runtime overhead. Features Events are defined as types, instead of as members in some class or as string IDs. Generics are used to move runtime overhead to compile time. (There's no Dictionary ) Listeners can include a priority number when subscribing to an event to control their order in the event execution, regardless of when the listener subscribes. Built-in support for targeting events to specific objects, with an optional source object that raised the event. Event data can be modified by listeners, or completely consumed to stop it. Events can be queued if other events are currently being raised. Usage To create an event bus, use the GenericEventBus type: TBaseEvent is the base type all event types must inherit/implement. You can use System.Object as the base type to allow any type to be used as an event, but I recommend defining an empty interface as the base type: Otherwise, any object can be raised as an event, which is weird and confusing. --- For ease of use, I recommend inheriting GenericEventBus with your own type and using that in your code instead: 💡 If you want to use the event bus as a static class for easier access, you can make a static wrapper using this template. --- To define new events, just define a type that inherits/implements your base event type: Can events be defined as classes instead? Events can be defined as either class or stru","default_branch":null,"files":null,"tree":[],"storefront":"/r/PeturDarri","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/PeturDarri/GenericEventBus/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}