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 do I manually trigger an InputField's event, such as "On End Edit"?

Discussion in 'Scripting' started by UmaroXP, Jan 17, 2021.

  1. UmaroXP

    UmaroXP

    Joined:
    Nov 12, 2015
    Posts:
    18
    Say I have a reference to a UI Input Field, but I don't know what object it came from, and I don't know what functions are assigned to it's events, is there any way for me to "force" an event to trigger via C# script?
     
  2. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,890
    Yes, assuming you have a reference to the InoutField you can call Invoke on the event you want to trigger.