| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|

Unity Event Framework is a simple and elegant way to handle events between your objects in Unity.
The framework uses the PubSub pattern with current Payload states for easy access to previously sent events.
Inspired by the work of SuperMaxim
There are several advantages to this approach, ranging from reducing cohesion in your project by not directly referencing objects to resolving asynchronous events within the project. You can also retrieve the state of an event at any time if it has been previously sent.
Installation process:
Unity Package Manager URL:
https://github.com/DevsDaddy/UnityEventFramework.git?path=/DevsDaddy/Shared/EventFramework/
Create Payload (Event Model) for your Events:
public class TestPayload : IPayload
{
public string Message = "";
}To Subscribe for Payload (event) you can add listener via EventMessenger Class:
EventMessenger.Main.Subscribe<TestPayload>(payload => {
Debug.Log(payload.Message);
});To Publish New Payload (Event) you can:*
EventMessenger.Main.Publish(new TestPayload {
Message = "Hello world!"
});Also you can get latest state for any early published payload (or null if not published yet):*
TestPayload currentPayload = EventMessenger.Main.GetState<TestPayload>();
Debug.Log(currentPayload.Message);See framework usage examples in other projects:
I plan to add the following functionality in the near future:
You can support the development and updating of libraries and assemblies by dropping a coin:
| Bitcoin (BTC) | bc1qef2d34r4xkrm48zknjdjt7c0ea92ay9m2a7q55 |
| Etherium (ETH) | 0x1112a2Ef850711DF4dE9c432376F255f416ef5d0 |
| Boosty | https://boosty.to/devsdaddy |
| Back | FazBrowse Home | New Git URL |