Author Topic: UIEventListener UIInput .onSubmit  (Read 1915 times)


  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 5
    • View Profile
UIEventListener UIInput .onSubmit
« on: December 29, 2014, 01:42:12 PM »

I have a prefab with a UIInput component that is added during runtime.  While the game is running after the prefab is added I can set the UIInput's  On Submit function through the editor and have it work successfully.

The issue that I'm having is when attempting to bind this through code.   I've successfully bound UIButton listeners during runtime through .onClick.   However attempting to do so with .onSubmit for this UIInput is not working. 

The example code I've found regarding "EventListener.Get(gameObject).onSubmit += myFunction" does not seem to work when used with UnityScript.  This also fails to work with .onClick.  I've found that I needed to remove the += in order to get it to work. I suspect this might be the reason for it failing on the UIInput.  If anyone knows the correct syntax to use with UnityScript i'd appreciate it.  Or if you know why I can't get the .onSubmit to work with UIInput i'd appreciate any help.



  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIEventListener UIInput .onSubmit
« Reply #1 on: December 30, 2014, 02:06:45 PM »
You should be using UIInput's onSubmit.
  1. EventDelegate.Add(input.onSubmit, YourFunction);