Skip to content

Instantly share code, notes, and snippets.

@nbrosz
nbrosz / MessagingBehavior.cs
Created Dec 11, 2017
A rough first draft attempt at a custom message passing system for Unity.
View MessagingBehavior.cs
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Messaging {
public abstract class MessagingBehavior : MonoBehaviour {
public delegate void MessageHandler(MessagingBehavior source, object data);
private void SendMessage (MessagingBehavior source, GameObject target, string message, object data) {
MessageRouter.Inst.SendMessage(source, target, message, data);