Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

How to provide the listener support like in EventTrigger?

Discussion in 'Scripting' started by Shayan, Apr 28, 2017.

  1. Shayan

    Shayan

    Joined:
    Jul 8, 2013
    Posts:
    53
    Hello!
    For EventTrigger I can choose methods from other scripts like listeners of events. I can do it just in the inspector.
    How can I realize it in a custom script to choose callback methods and their arguments just in the inspector?
     
  2. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,773
    UnityEvent is a wonderful class. Make a public one and it'll just work. And you can use UnityEvent<string> to accept a string parameter, etc.