Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Advanced Input Field

Discussion in 'Assets and Asset Store' started by fennecx_development, Jul 29, 2017.

  1. ageana

    ageana

    Joined:
    Nov 6, 2013
    Posts:
    48
    Is it possible to capture the event when the return key type is SEND? Also how do I keep the keyboard open after I press it?

    Thank you!
     
    Ardito92ITA likes this.
  2. zauberzaubar

    zauberzaubar

    Joined:
    Jun 18, 2019
    Posts:
    53
    Hi there! I'm currently trying out the asset (1.99) and noticed that it has problems with auto size (TMP) and best fit (only tested in the editor so far). It can be seen e.g. in the Form sample and making one of the fields best fit. The Content game objects width and height are automatically changed (seems unnecessary) and the text gets very small very quickly. When deleting characters, the game objects size is also not increased again. It seems that the correct behavior would be to just leave the Content size, or rather set it to be stretched to its parent.
     
  3. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    You can use the .ShouldBlockDeselect property to keep the inputfield (& keyboard) focused. When set to true it will automatically reselect itself after submit or when tapping another UI element.
    The OnEndEdit event of the AdvancedInputField instance should still get called when the submit key gets pressed on the native keyboard. That event returns an EndEditReason enum value which you can use to see why it tried to deselect the inputfield. For example when value is KEYBOARD_DONE => Do your send action and when value is KEYBOARD_CANCEL set to .ShouldBlockDeselect to false again, because the user tried to cancel/dismiss the keyboard.
     
    ageana likes this.
  4. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Hadn't really tested that usecase before, but this should fix it:
    In TextRenderer.cs change the PreferredSize property to this:
    Code (CSharp):
    1. public Vector2 PreferredSize
    2. {
    3.    get
    4.    {
    5.       if(ResizeTextForBestFit)
    6.       {
    7.          ScrollArea scrollArea = GetComponentInParent<ScrollArea>();
    8.          if(scrollArea != null)
    9.          {
    10.             return scrollArea.Viewport.rect.size;
    11.          }
    12.       }
    13.  
    14.       return preferredSize;
    15.     }
    16. }
     
  5. zauberzaubar

    zauberzaubar

    Joined:
    Jun 18, 2019
    Posts:
    53
    Thanks for the quick answer! Any ETA on when version 2.0 will be approved by Unity?
    Oh and also: would be nice to have the convert functionality not per scene but per gameobject / text input component (in the three-dots-menu) ;)
     
    Last edited: Jan 11, 2021
  6. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
  7. zauberzaubar

    zauberzaubar

    Joined:
    Jun 18, 2019
    Posts:
    53
    Great, just tried it. The above fix for auto sizing fields also works fine with 2.0
     
  8. ageana

    ageana

    Joined:
    Nov 6, 2013
    Posts:
    48
    How can I have the action bar show on top of the input field? Right now it shows at the bottom and sometimes it is under the keyboard. I'm not using a custom action bar, it is the default one.
     
  9. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    There isn't really a setting in the plugin to change this, but the behaviour is based on how Android positions it:
    By default it appears above the caret position or selected text, except if the action bar can't be displayed completely above it (when the action bar would be partially or completely rendered offscreen at the top of your device screen). In that case it will try to display it below the caret position or selected text.
     
  10. carl_unity685

    carl_unity685

    Joined:
    Apr 9, 2019
    Posts:
    1
    Hello,
    Is it possible to use your Advanced Input Field asset together with the new UI Toolkit?
     
  11. Soulside

    Soulside

    Joined:
    Nov 1, 2018
    Posts:
    30
    Hello, @jpienbro! Thanks for amazing plugin!
    We currently try to use the native Android and iOS emojis.
    We wrote our own custom TMP_TextWithEmojis which is based on the https://forum.unity.com/threads/full-emoji-support-api-emoji-sequen.660310/ plugin.
    To get the native Android or iOS emojis we use the https://github.com/iBicha/EmojiTexture plugin.
    So we combined two plugins in our implementation.
    The current problem is: if the rich text is active and "TMPEmojiRichTextData" is in the config, the Emojis Allowed is enabled, the native keyboard on Android does not show the input for emojis.
    Can you please help us fix it?
     
    Last edited: Feb 1, 2021
  12. YamatoKuroiwa

    YamatoKuroiwa

    Joined:
    Feb 3, 2021
    Posts:
    6
    Hello.
    I am building a communication app in Unity 2019.2.21.
    When there are arrow keys on the keyboard, the caret should normally move when pressed, but it doesn't move in this plugin, which is probably a bug.
    I am testing it in AdvancedInputField/Samples/Scenes/TextMeshPro/Chat.scene.

    Please let me know if there is something I need to configure or something I should not do.
    If it's a bug, I'm hoping for a quick fix.
     

    Attached Files:

  13. swifter14

    swifter14

    Joined:
    Mar 2, 2017
    Posts:
    165
    Hi there, a simple question- can you explain about the emojis copyright issues?
    I purchased your asset to deal with emojis
    All I need is to support emojis, because I see the emojis on my mobile keyboard (android/ios) but in the input field / text it shows as empty squares.
    Do I need to download spreadsheets ? Is it legal? I don't understand what the big apps do
     
  14. mpsol

    mpsol

    Joined:
    Nov 25, 2020
    Posts:
    2
    Hello.
    When typing text on Android or iPhone, if there are conversion suggestions
    I would like to add an underline to the characters I type.

    Please refer to the following image for a concrete example.
    WS000175.JPG



    In order to achieve this, which part of the "Advanced Input Field" do I need to modify?
    I would appreciate any hints.
     
  15. Soulside

    Soulside

    Joined:
    Nov 1, 2018
    Posts:
    30
    It seems that the plugin creator does not support the plugin anymore...
     
  16. Gangsta-Geek

    Gangsta-Geek

    Joined:
    Aug 11, 2012
    Posts:
    32
    any confirmation on this?
     
  17. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    133
    Sorry for the late response, (I didn't notice people were still posting in this thread for the old version of the plugin).

    Haven't looked into the new Unity UI system yet, but I've added it as feature request on the issue tracker (of version 2 of the plugin).
    https://github.com/support-fennecx/advancedinputfield2/issues/33
    Probably won't be implemented on short term, though. At a first glance, it looks very different compared to the current Canvas system.
     
  18. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    133
    Don't really understand what you are trying to say.
    Version 1 of the plugin hasn't been updated for a while now, so don't know why something would suddenly be broken.
    If this issue is for version 2 of the plugin, please post it (with more details) in the support thread for version 2: https://forum.unity.com/threads/advanced-input-field-2.1028128/
     
  19. fcayecr

    fcayecr

    Joined:
    Jun 9, 2020
    Posts:
    5
    Hi.

    Thank you for making a very useful plugin.
    I am writing this comment because there is something that I haven't been able to make work.
    I want to make sure that the Selection works properly, specially when there is text that gets almost to the edge of the content area.

    I will attach 2 pictures of it, one using Unity Text and other using TextMeshPro. Some of the letters at the rightmost side doesn't look like they are selected, if you copy or cut they get selected properly so I'm guessing this is related to the TextSelectionRenderer,

    In one of the screenshots, I am using the Multiline Scene of the Samples folder without modifying anything, so I believe it could be reproducible that way.

    I need to make sure the blue area covers all the characters property, what do I need to do to achieve this?
    selection.png message.png

    (Sorry if this has been dealt with before, I searched for "selection" but couldn't find any comments related to this.)
     
  20. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    133
    Which version of the plugin are you using?
    I've quickly tried this with the "Multiline" scene in the Unity Editor (using version 1.9.10 of the plugin) and there it does seems to properly draw the selection around all characters.
    upload_2021-5-16_16-59-58.png
     
  21. fcayecr

    fcayecr

    Joined:
    Jun 9, 2020
    Posts:
    5
    I am using the plugin version 1.9.10, and Unity Editor version 2019.2. This is a blank project in which I only imported the plugin as it is.

    After testing using different strings, I think I can tell the conditions in which this happens. This is probably happening when there are no spaces, for example, a long word that breaks into a next line. Long numbers, or text that generally lacks spacing like Japanese, has the selection blue box omitting the final character of that line

    These are some examples:
    • words with space or not
      • words with space or not.png
      • This is a small paragraph with long words that get cut across 2 lines, and it looks like one letter is missing.
      • text:
        • what is the longest word we know? maybe it is Pneumonoultramicroscopicsilicovolcanoconiosis maybe it is Hippopotomonstrosesquippedaliophobia big words dont fit in one line, the line breaks them. get close to the right edge of the screen while using s paces
    • japanese paragraph (no spacing)
      • japanese-paragraph-no-spaces.png
      • This is a small japanese paragraph, spacing is generally not used.
      • text (sorry, I was trying to paste the text from the picture, but forum said it contains forbidden chinese characters, so I will give a link to a random wikipedia article with a paragraph that can be copied)
    • japanese paragraph (entered random spaces)
      • japanese-paragraph-spaces.png
      • It is the same paragraph as the one above, but I introduced spaces randomly.
      • text (sorry, unity is not allowing me to paste it because it mentions there are forbidden chinese characters, I will link a random wikipedia article which can be copied and add random spaces in it afterwards)
    From what I have seen so far, it seems to happen when a word is cut across 2 lines, and the final letter of that line doesn't seem to be taken into account. I haven't been able to take a deep look into the code yet, but I have the feeling it may be related to the GetLineEndCharIndex() function of TextSelectionRenderer?

    Could you please help me check if it's possible to solve this?
     

    Attached Files:

  22. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    133
    Ah, yes. Seems to happen when a long word gets wrapped across 2 lines. Probably didn't notice it before, because most of the time the line ends with an empty space character.
    To fix it change line 115 in TextSelectionRenderer to this:
    Code (CSharp):
    1. Vector2 topRightCorner = endCharInfo.position + new Vector2(endCharInfo.width, 0);
     
  23. fcayecr

    fcayecr

    Joined:
    Jun 9, 2020
    Posts:
    5
    Thanks a lot !
    This fixed it. :)
     
  24. fcayecr

    fcayecr

    Joined:
    Jun 9, 2020
    Posts:
    5
    Hi.

    I'm sorry, but there is one more think I would like to ask.
    I am using the Action Bar to bring out the copy and paste buttons, they usually select the closest word and the action buttons come out, but because it is not detecting spacing in japanese words, the whole paragraph of japanese text may be selected at that time.

    allselected.png

    Is it possible to support word breaks in japanese text?
    Alternatively, is there a way to make the Action Bar come out if I tap a second time on the same spot the Caret is currently located at, without selecting the current word?
     

    Attached Files:

    • word.png
      word.png
      File size:
      206.1 KB
      Views:
      269
  25. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    133
    1. I'm not really familiar with Japanese characters, but you could try adding it to the WORD_SEPARATOR_CHARS in TextNavigator.cs if it's a different character than the normal space character.

    2. The only way is just enable the ActionBar options (in the inspector) and tapping the blue cursor below current caret position. Then it will show the ActionBar without selecting the word.

    (As a side note: as mentioned in the first post of this thread, version 2 of the plugin has been available for a while now and is free to download for existing users. Version 1 of the plugin will only receive critical bugfixes for a while, so no new features and will eventually be deprecated).
     
  26. said123sawn

    said123sawn

    Joined:
    Oct 31, 2019
    Posts:
    26
    Hello can you help me? I getting some errors
     
  27. wellzito

    wellzito

    Joined:
    Mar 29, 2017
    Posts:
    5
    Hello, I've been facing this problem every time I change scenes. I used Input for the login and password fields, after I call the next scene it returns this error. I have the latest version of the store, I've tried to put checks if the object is null or not, still nothing solves it so far.

    upload_2023-3-6_14-39-16.png
     
  28. Farshadfarzan368

    Farshadfarzan368

    Joined:
    Sep 10, 2022
    Posts:
    65
    Friends, can anyone make it for Arabic and Farsi? In my opinion, if the caret could move in the opposite direction if it were a Persian text, it would be correct. We just need to make the caret move in the opposite direction, because in Arabic everything is reversed.
     
  29. Farshadfarzan368

    Farshadfarzan368

    Joined:
    Sep 10, 2022
    Posts:
    65
    Can you make the caret move in reverse? If this is done, I think it will be correct in Farsi and Arabic, it is better in the first version, because in the second version, there is a lot of problem with Arabic
     
  30. softconstruct

    softconstruct

    Joined:
    Jun 22, 2020
    Posts:
    2
    Hi, is it possible to select all text programmatically, for example when Im tapping on input field, it will automatically select all text