Search Unity

  1. Full schedule for #UniteBerlin is now available! Featuring talks on our roadmap, hands-on labs and much more! Check it out!
    Dismiss Notice
  2. Unity 2018.1 has arrived! Read about it here
    Dismiss Notice
  3. Scriptable Render Pipeline improvements, Texture Mipmap Streaming, and more! Check out what we have in store for you in the 2018.2 Beta.
    Dismiss Notice
  4. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  5. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  6. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Simple question about UnityEvents

Discussion in 'Scripting' started by PrimeDerektive, May 18, 2018.

  1. PrimeDerektive


    Dec 13, 2009
    So if I have a custom UnityEvent<t0, t1> that takes multiple arguments... In the editor I can either add "dynamic listeners" that take the same corresponding arguments, or "static parameters", which are any functions that take 0 or 1 argument (provided the argument is a standard unity type).

    I'd like to add a listener through script to my custom UnityEvent, but the listener doesn't take the parameters that are declared in the UnityEvent (it takes no parameters, its a simple function), so it fails and says it requires a function that takes the corresponding arguments.(cannot convert "method group" to "UnityAction<GameObject, GameObject>").

    You can add simple listeners through the inspector that don't have the corresponding parameters, so how do you do it in script?