Skip to content

A simple global event system in unity

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
LICENSE.meta
Notifications You must be signed in to change notification settings

carreraSilvio/SimpleEventSystem

Repository files navigation

SimpleEventSystem

A simple global event system

Usage

void Awake()
{
    SimpleEventManager.AddListener("Test", Handler);
    SimpleEventManager.AddListener("Test", Handler2);
    SimpleEventManager.Invoke("Test");
}

void Handler()
{
    Debug.Log("handler called");
}

void Handler2()
{
    Debug.Log("handler2 called");
}
public enum MyEventNames
{
    PlayerTookDamage,
    PlayerHealed,
    PlayerDied
}

void Awake()
{
    SimpleEventManager.AddListener(MyEventNames.PlayerDied, HandlePlayerDied);
    SimpleEventManager.Invoke(MyEventNames.PlayerDied);
}

private void HandlePlayerDied()
{
    Debug.Log("player died handler called");
}

Install

Unity 2019.3

  1. Open the package manager and point to the rep url

Imgur

About

A simple global event system in unity

Topics

Resources

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
LICENSE.meta

Stars

Watchers

Forks

Packages

No packages published

Languages