Unity Smessage

SMessage for Unity

The small and simple, but powerful and strict-typed messaging system for Unity engine. I’ve created it for using in my own projects, but shared it after post on Habrahabr (RUS

Getting Started

Just include all script files somewhere in your own project, for example Assets/Vendor/SMessage and start using it!

Create event class with GameObject value

public class SMessageExample :  AbstractSMessageValued<GameObject> {
  public SMessageExample (GameObject value) : base(value) { }

Create call of this event in someone MonoBehaviour class

public class ExampleObject : MonoBehaviour {
  public void OnMouseDown () {
    SManager.SCall(new SMessageExample(gameObject));

Add handler for this event in another MonoBehaviour class

public class ExampleHandlerObject : MonoBehaviour {
    // Add event listener in OnEnable callback
    public void OnEnable() {

    // And remove in OnDisable callback
    public void OnDisable() {

    private void OnMessage (SMessageExample message) {
      Debug.Log("OnMouseDown for object ";

More examples


  • Unity3D
  • Hands

Running the tests

Tests are not yet writen, but they will be somewhen.


Feel free to create issues and contribute your code!



This project is licensed under the WTFPL - see the license.txt file for details