Giter Club home page Giter Club logo

unityeventaggregator's Introduction

Unity Event Aggregator

Event aggregation in Unity made easy! Decouple your GameObjects for simpler and cleaner code.

Why Should I Care?

Look at how gross this is. Disgusting, huh? Now what if there was an easy way to send messages to other game objects in Unity3D without coupling everything to hell or using skittles magic?

That way is here.

Just drop the .dll into your existing Unity project and get started. Messages must be a class.

To start listening to events, your MonoBehaviour must also inherit from IListener<(message)>. This will create the handler for the message.

Make sure you register and unregister with the EventAggregator in your MonoBehaviour's Start and OnDestroy methods. I'll probably create a base class to inherit from that will do this automatically for you...when I'm feeling less lazy.

Download

v1.0.0.0 Download

Example Usage

https://github.com/EricFreeman/1800ContactsEndlessRunner/blob/master/src/Assets/Scripts/UI/Score.cs

unityeventaggregator's People

Contributors

adamveld12 avatar ericfreeman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

unityeventaggregator's Issues

Create base class to auto (un)register listeners.

You shouldn't have to manually register in the Start and unregister in the OnDestroy methods to use EventAggregator. This makes it easy to forget and introduce bugs, plus add unnecessary amounts of code. Make a baseclass that extends MonoBehaviour that just searches for all interfaces of IListener<(message)> and handles registration for you.

Who are you

The Eric Freeman I know would never make something like this.

Force struct for messages

Force structs for messages because they don't create garbage and get copied when passed to message handlers

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.