Skip to content

shlifedev/event-flow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EventFlow

A very easy to use zero-gc game event sending/listen system.

  • This is useful for decoupling UI code from game code.

  • You can listen to any event that happens in your game where it inherits from IEventListener<>.

  • Sending/receiving events does not incur any unnecessary GC. (struct only)

Requirement

  • UniTask
Movie_001.webm

How to use

Just inherit the IEventMessage to the structure.

 public struct YourEvent : IEventMessage{ 
   public string Message;
 }
public class YourClass : MonoBehaviour, IEventListener<YourMessage>{
    void OnEnable(){
         EventFlow.Register(this);
    }
    void OnDestroy(){
         EventFlow.UnRegister(this);
    }

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

About

non gc game event broadcast system for unity.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published