Freyja Event System
A robust and flexible event system for Unity, enabling efficient communication between game objects.
Features
Generic Events: Define events with custom data types for flexibility.
Listener Interface: All listeners implement a common interface for easy identification.
Automatic Registration: EventListeners automatically register and unregister based on their lifecycle.
Safe Event Triggering: Ensures only compatible listeners receive events.
Requirements
Unity 2021.3.22.f1 or later
Dependencies
Name
Tags
Installation
Install from Unity Package Manager -> (
Window -> Package Manager -> Add package from git URL
)

Copy and Paste this URL link https://github.com/winartodev/Freyja-Event-System.git
Example Usage
Define your Custom Event
using Freyja.EventSystem;
public class CarEvent : Event<CarEvent>
{
public string Name { get; set; }
public int Speed { get; set; }
public override string ToString()
{
return $"Name: {Name}, Speed: {Speed}";
}
}
Create an Event Listener
using Freyja.EventSystem;
public class CarEventListener : EventListener<CarEvent>
{
public override void OnEventRaised(object sender, CarEvent value)
{
Debug.Log("Car Event Triggered " + value);
}
}
Trigger Listener
public class Car : MonoBehaviour
{
public void TriggerCar(string carName, int speed)
{
CarEvent.Trigger(this, new CarEvent()
{
Name = carName,
Speed = speed,
});
}
};
Last updated