Skip to content

shlifedev/event-flow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EventFlow

EventFlow is a Pub-Sub event system that can be easily used universally in Unity or general .NET projects.

  • Zero GC with Roslyn Source Generator
  • Very Simple
  • Intuitive

The following is an example of sending a message to deal damage when a game character is touched.

Movie_001.webm

Installation

Usage

 public struct YourMessage : IEventMessage{ 
   public string Message;
 }

Very Simple Usage

Inherit & Subscribe IEventListener Your Class.

[EventFlowListener]
public partial class YourClass : MonoBehaviour, IEventListener<YourMessage>{
    void OnEnable(){
         RegisterEventListener(this);
    }
    void OnDisable(){
         UnregisterEventListener(this);
    }

    public UniTask OnEvent(YourMessage args){
         Debug.Log("Received! => " + args.Message);
    }
}

And Broadcast Your Message.

     EventFlow.Broadcast(new YourMessage(){Message="hi"});

FAQ

Why should you use the EventFlowListener Attribute?

Internally, it uses the Roslyn source generator to help you subscribe to and unsubscribe from multiple message types without GC. If you use EventFlow.Register(this); instead, you don't have to use it, but we recommend using it.

About

non gc game event broadcast system for unity.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •