Search Unity

Question Need help with invoking InputField twice on submit !

Discussion in 'Input System' started by Vagabond_, May 27, 2021.

  1. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hello,

    i am having a weird issue where subscribing to an "InputField" onSibmit event triggers the subscribed method twice...

    EDIT : the issue is only with TextMeshPro InputField... it's fine when using the standard InptField...

    Code (CSharp):
    1.  
    2. [SerializeField] private TMP_InputField chatInputField;
    3.  
    4. private void OnEnable()
    5. {
    6.     chatInputField.onSubmit.AddListener(OnInputFieldSubmit);
    7. }
    8.  
    9. private void OnInputFieldSubmit(string s)
    10. {
    11.     Debug.LogError("On Input Field submit is called twice when press Enter...");
    12. }
    Only the new InouSystem is set active...

    upload_2021-5-27_23-18-28.png

    The issue is gone when i set the "Submit" bind to None like in the image below, but then non of the other UI elements is receiving the Submit event

    upload_2021-5-27_23-21-8.png

    If someone has any idea how to fix that will be great !
     

    Attached Files:

    Last edited: May 27, 2021