Search Unity

  1. Get all the Unite Berlin 2018 news on the blog.
    Dismiss Notice
  2. Unity 2018.2 has arrived! Read about it here.
    Dismiss Notice
  3. We're looking for your feedback on the platforms you use and how you use them. Let us know!
    Dismiss Notice
  4. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  6. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  7. 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
  8. 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?