Unity Notify
简体中文 | English
Packages Manifest
{
"dependencies": {
"com.aio.notify": "latest"
},
"scopedRegistries": [
{
"name": "package.openupm.com",
"url": "https://package.openupm.com",
"scopes": [
"com.aio.notify"
]
}
]
}
Unity PackageManager
open upm Chinese Version
Name: package.openupm.cn
URL: https://package.openupm.cn
Scope(s): com.aio.notify
open upm International Version
Name: package.openupm.com
URL: https://package.openupm.com
Scope(s): com.aio.notify
Command Line
open upm-cli
openupm add com.aio.notify
- Unity Notify is a lightweight event notification system that supports event subscription, broadcasting, and unsubscription.
- ✅ Support event class implementation.
- ✅ Support event parameter passing.
- ✅ Support event parameter generics.
- ✅ Support event priority.
- ✅ Support event subscription.
- ✅ Support event unsubscription.
- ✅ Support event broadcast execution based on coroutine, not blocking the main thread.
- ✅ Support event automatic registration.
- ✅ Support event automatic unRegistration.
- ✅ Support event automatic broadcast.
- ✅ Support event automatic priority.
EventSystem.Initialize();
EventSystem.AddListener(eid, OnEvent);
EventSystem.AddListener<[T1~T9]>(eid, OnEvent);
EventSystem.Broadcast(eid);
EventSystem.Broadcast(eid, [T1~T9]);
EventSystem.RemoveListener(eid, OnEvent);
EventSystem.RemoveListener<[T1~T9]>(eid, OnEvent);
EventSystem.RemoveListener(eid);
public class EventListener1 : EventHandler
{
public override int Key { get; } => 0;
protected override void Invoke() => Console.WriteLine("OnEvent");
}
public class EventListener2 : EventHandler<[T1~T9]>
{
public override int Key { get; } => 0;
protected override void Invoke(<[T1~T9]> args) => Console.WriteLine("OnEvent");
}
xinansky |
- If this package is helpful to you.
- Please consider adding a ⭐ to show your support.
- It will be a great encouragement for me to continue to improve.