Search Unity

Question Input Field TMP - On Deselect() Not activating

Discussion in 'UGUI & TextMesh Pro' started by Mortalanimal, Jun 14, 2020.

  1. Mortalanimal

    Mortalanimal

    Joined:
    Jun 7, 2014
    Posts:
    567
    Hi, I am using an Input Field, and there are several ways I want to deactivate it. I can already Deactivate it by pressing "Enter", and "ESC". But I cant Deactivate it while pressing anywhere else on the screen or on any other UI buttons etc.

    Many thanks

     
  2. DiyanC

    DiyanC

    Joined:
    Oct 13, 2020
    Posts:
    1
    I think I am pretty late but oh well..
    Actually there is a way that deselects the Input Field. Double Click anywhere else. BUT
    I was also looking for a way to disable the Input Field on a single click and couldn't find one
    But after trial and error I found 1 way
    Now WARNING : I have tried only in the Text Mesh Pro Input Field. I couldn't find it in the normal one.
    For this you have to edit the TMP Input Field Script itself.
    Go to line 1511 or just hit 'Ctrl + F' and search for "Mouse0".
    Now change :
    Doubt Ans Pic 1.png

    To :
    Doubt Ans Pic 2.png

    Save the script and now it should work.
    If you click anywhere except any other UI or Selectable Item, the TMP Input Field should get deselected.
     
    KReguiegReply likes this.
  3. Mortalanimal

    Mortalanimal

    Joined:
    Jun 7, 2014
    Posts:
    567
    thanks for reply, to be honest I solved it ages ago, I also tampered with TMP script though I think I used a different method to do it, cant remember what
     
    KReguiegReply likes this.