title: Pass Generic Delegate Argument To UnityEvent
body: <p>I am setting up a registry for callbacks (my own event handler system).</p>
  
  <p>Client code is supposed to call <code>Register</code> and they can add a function to handle an event when its fired. So for example say FunctionA and FunctionB are both subscribed to "GOT_HIT" event, both functions will be invoked.</p>
  
  <p>I know UnityEvents are the way to go but I can't seem to actually add methods to them. I cannot get the syntax right if I am using an argument. Here is my code which is erroring out on <code>_battleEvents.AddListener(handler);</code> because:</p>
  
  <blockquote>
    <p>Severity   Code    Description Project File    Line    Suppression State
    Error   CS1503  Argument 1: cannot convert from 'ActionHandler' to 'UnityEngine.Events.UnityAction>'</p>
  </blockquote>
  
  <p>Here is my best attempt at the code specifying a delegate type:</p>
  
  <pre><code>public class ActionEvent:UnityEvent&lt;Dictionary&lt;string, Object&gt;&gt;
  {
  
  }
  
  public delegate void ActionHandler(Dictionary&lt;string, Object&gt; props);
  
  public class Dispatcher
  {
    static Dispatcher _singleton = new Dispatcher();
    static Dictionary&lt;string, Object&gt; _subscriptions = new Dictionary&lt;string, Object&gt;();
  
    static ActionEvent _battleEvents = new ActionEvent();
  
  
    public static void Register(string actionName, ActionHandler handler)
    {
      switch(actionName)
      {
        case "battle":
          _battleEvents.AddListener(handler);
          break;
        default:
          Debug.Log("Error");
          break;
      }
    }
  </code></pre>
  
  <p>If you can tell me how I can make my <code>handler</code> parameter correctly such that I can add any function I want to pass that would be ideal.</p>
  
  <p>I am able to get it to work when I pass in an anonymous function like so:</p>
  
  <pre><code>_battleEvents.AddListener((Dictionary&lt;string, Object&gt; props) =&gt; { });
  </code></pre>
  
  <p>But I want to be able to set it from the argument.</p>
  
  <p>I <em>could</em> just invoke my actual handler in there as such:</p>
  
  <pre><code>_battleEvents.AddListener((Dictionary&lt;string, Object&gt; props) =&gt; {handler(props); });
  </code></pre>
  
  <p>But I'm trying to skip that.</p>
  
  <p>I.E. I'd like to do this:</p>
  
  <pre><code>  public static void Register(GenericDelegate handler)
    {
        // _battleEvents is UnityEvents object
        _battleEvents.AddListener(handler);
    }
  </code></pre>