Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Distinguish between OnSubmit and OnDeselect for InputField on RC1

Discussion in 'UGUI & TextMesh Pro' started by BonyYousuf, Nov 9, 2014.

  1. BonyYousuf

    BonyYousuf

    Joined:
    Aug 22, 2013
    Posts:
    110
    Hi,
    I just updated to RC1 and now the EndEdit is calling the function whenever I press enter and whenever I deselect the input field. But I only want it to work when I press enter. I don't want it to do anything If I deselect. Please let me know the way to distinguish between this.
     
  2. jfarias

    jfarias

    Joined:
    Apr 8, 2014
    Posts:
    53
    According to the release notes:
    • UI: Renamed InputField onSubmit to onEndEdit to avoid confusion since it's also invoked when user clicks away from InputField.
    And according to the scripting reference, there still is an OnSubmit event that you can use for submissions only. You can find it on the event trigger (funnily named "Sumbit") through the inspector or using the ISubmitHandler on a script. I haven't tried it, though. Give it a shot and see if it works.
     
  3. BonyYousuf

    BonyYousuf

    Joined:
    Aug 22, 2013
    Posts:
    110
    Okay I will look into it :)
     
  4. BonyYousuf

    BonyYousuf

    Joined:
    Aug 22, 2013
    Posts:
    110
    I tried it but I could not fire the OnSubmit event. I tried it with the EventTrigger component and attached a gameobject's public function to it. But it did not fire
     
  5. sam_stitch

    sam_stitch

    Joined:
    Jun 6, 2023
    Posts:
    9
    This result comes up on google for this question and I am still having this issue in unity 2022.3.10f1, was a solution ever found?