A type-safe event system for Unity3D based on the event listener pattern. More info http://saltydog.digital/usage-pattern-for-a-type-safe-unity-event-system/
C# Ruby
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
ProjectSettings update project to Unity 5.3.4f1 Jun 27, 2016
.mcs add syntax checking for Vim Neomake users Jul 6, 2016
LICENSE add Assets/Source/EventManger and basic project docs Feb 19, 2016



A type-safe event system for Unity3D based on the event listener pattern. Original blog article http://saltydog.digital/usage-pattern-for-a-type-safe-unity-event-system/

The code in this repository is a minor variation with added examples and tests of the event system originally described here: http://www.willrmiller.com/?p=87


EventManager is useful when you want to keep your codebase loosely coupled. Publishers and subscribers don't need to know anything about each other. EventManager is not a solution for exposing callbacks in the Unity Editor, Unity's own EventSystem may be more appropriate for that use case.

  • Loosely coupled
  • Type-safe
  • Avoids breaking changes when new event parameters are added


Install the source or build a DLL.

Option 1: Source Installation

Copy the Assets/EventManager folder to your project's Assets folder.

Source and Unit Tests

NOTE: Unit tests are stored in an 'Editor' folder so they are not added to your build

mkdir tmp
cd tmp
git clone https://github.com/robertwahler/EventManager
cp -R EventManager/Assets/EventManager ~/your_unity_project/Assets/

Examples (optional)

cp -R EventManager/Assets/Examples ~/your_unity_project/Assets/EventManager/

Record Version SHA (optional)

git --git-dir=./EventManager/.git log --pretty=format:%h -1 > ~/your_unity_project/Assets/EventManager/VERSION

Option 2: DLL Installation

Create a DLL and copy it to your Assets folder. These instructions expect the standard Mono mcs compiler. If you need it on OS X, you can install it with HomeBrew brew install mono

mkdir build

mcs -recurse:'Assets/EventManager/Source/*.cs' \
    -lib:/Applications/Unity/Unity.app/Contents/Frameworks/ \
    -lib:/Applications/Unity/Unity.app/Contents/Frameworks/Managed/ \
    -r:UnityEngine \
    -r:UnityEditor \
    -target:library \

mkdir Assets/Lib

cp build/SDD.EventManager.dll ~/your_unity_project/Assets/Lib/


The NUnit test framework is included in Unity 5.3 and higher. Tests require installation of the UnityTestTools asset for Unity 5.2 and lower.

Running tests from Unity IDE

There is no Unity hotkey for running tests. Instead, manually use this menu sequence:

Main Menu: Window, Editor Tests Runner
Editor Tests: Run All

Running tests from the command line

All command line test scripts require a Ruby Thor scripting environment with Ruby > 2.0. These commands are configured for execution on Mac OS X. Other environments will need to modify the Ruby source in the ./tasks folder.

gem install bundler
bundle install

Using Unity to run the tests (SLOW)

You need to shutdown the Unity IDE to run this command.

thor test:unit

Using NUnit-console (FAST)

The Unity IDE can be running.

thor test:nunit

Using Guard and the NUnit-console (CI)

This command will watch for file changes and automatically run the unit test suite. The Unity IDE can be running.

bundle exec guard

Syntax checking with Vim

Do you use Vim instead of MonoDevelop/Visual Studio? Install https://github.com/neomake/neomake and add this to your .vimrc

let g:neomake_cs_mcs_maker = {
  \ 'args': ['@.mcs'],
  \ 'errorformat': '%f(%l\,%c): %trror %m',
  \ }


See Assets/Examples


MIT, see ./LICENSE for details.