Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Advanced Input Field 2

Discussion in 'Assets and Asset Store' started by jpienbro, Dec 25, 2020.

  1. jpienbro

    jpienbro

    Joined:
    Sep 24, 2014
    Posts:
    423
    Advanced Input Field 2:
    Asset Store link

    The improved version of the original Advanced Input Field plugin. Rewritten to support more complex features.

    This plugin provides a more Advanced Input Field that has a lot more features and properties than the official Unity InputField. It still inherits from the Selectable base class, so it can be used with the Unity EventSystem.
    Also, it has it's own bindings for the native keyboards. This made it possible to provide a better user experience and to fix several issues that existed in the official Unity InputField.

    Supported platforms: PC, Mac, Android, iOS & UWP (PC)

    Features:
    - Default features of the official Unity InputField
    - More event callbacks (OnSelectionChanged, OnCaretPositionChanged, OnSpecialKeyPressed,...)
    - Filters to process, decorate, block or allow text changes
    - Validate characters when text changes in native code (using CustomCharacterValidators)
    - Next Input Field option to control which InputField should be selected when done editing. (Tab key on Standalone platforms and Done/Next key on Mobile platforms).
    - Show ActionBar with cut, copy, paste and select all options
    - Touch Selection Cursors (Draws selection sprites for start and end of text selection to control the selected text more easily in large text blocks)
    - Event for keyboard height changes in the new NativeKeyboard binding.
    - KeyboardScroller component to scroll content when NativeKeyboard appears/hides.
    - Support for TextMeshPro Text Renderers
    - Support for full emoji range
    - Support for rich text
    - Multiple InputField Modes (indicates how to handle text bounds changes): SCROLL_TEXT, HORIZONTAL_RESIZE_FIT_TEXT and VERTICAL_RESIZE_FIT_TEXT
    - And more...

    NOTE: Asian IME are not supported

    Regarding emojis:
    Due to licensing issues of emoji spritesheets there are no emoji assets included in the plugin. See the Documentation file of the plugin for details on how to create and configure your own emoji asset file.

    Android samples:
    These are builds (apk) of the Sample scenes of the plugin build using the latest version of the plugin.
    Samples (Android)

    Feel free to contact me for feature requests and reporting bugs.
    Please check the included documentation (pdf) and the bug/feature tracker of the plugin before reporting bugs/asking for features:
    Documentation
    Bug/Feature Tracker
     
    Last edited: Feb 28, 2021
    jiraphatK likes this.
  2. jiraphatK

    jiraphatK

    Joined:
    Sep 29, 2018
    Posts:
    78
    I've tried the sample chat APK and most emoji worked except for some sequence with variant skin color.
     
  3. jpienbro

    jpienbro

    Joined:
    Sep 24, 2014
    Posts:
    423
    Thank your for reporting, I'll check if those emoji are included in the emoji spritesheet I used.
     
  4. jiraphatK

    jiraphatK

    Joined:
    Sep 29, 2018
    Posts:
    78
    If it's from Emoji Data then it's included. The problem is probably text mesh pro can't handle combining multiple sprite tag to give different sprite.
     
  5. jpienbro

    jpienbro

    Joined:
    Sep 24, 2014
    Posts:
    423
  6. bryan_l1

    bryan_l1

    Joined:
    Apr 6, 2017
    Posts:
    8
    Hello,

    I am upgrading from the previous version and followed the documentation to remove the files from the old plugin.
    Upon installing Advanced Input Field 2 via the package manager I am getting the following error in the editor:

    Assets/AdvancedInputField/Editor/Scripts/EmojiAssetGenerator.cs(153,49): error CS0246: The type or namespace name 'TexturePacker' could not be found (are you missing a using directive or an assembly reference?)

    Please let me know the steps to resolve the error. Thanks!
     
  7. bryan_l1

    bryan_l1

    Joined:
    Apr 6, 2017
    Posts:
    8
    Also in the previous version on mobile it takes around 1 second of holding your finger on the input field for the "Copy, Paste" option buttons to appear. Is there a parameter that can be modified to make the option buttons appear sooner? (ie. 0.5 seconds)
     
  8. jpienbro

    jpienbro

    Joined:
    Sep 24, 2014
    Posts:
    423
    Seems like the problem is that the skin variants aren't being parsed yet from the emoji json file. They are not a separate entries in the main emoji json array as I expected, but rather there is a sub json array called "skin_variations" for the emojis that have skin variants.
    I'll try to update the parser later today.
     
    Last edited: Jan 12, 2021
  9. jpienbro

    jpienbro

    Joined:
    Sep 24, 2014
    Posts:
    423
    Which Unity and TextMeshPro version are you using? I've had that error in some versions of TextMeshPro and added preprocessors for them, but maybe you're using a different version.
     
  10. zauberzaubar

    zauberzaubar

    Joined:
    Jun 18, 2019
    Posts:
    52
    Feature request: add proper native looking mobile text selector handles on iOS. The current ones are modeled after the Android ones I think?

     
    ibyte likes this.
  11. zauberzaubar

    zauberzaubar

    Joined:
    Jun 18, 2019
    Posts:
    52
    Some issues I have with the new version (at least some of which also existed in 1.99):
    • Conversion tool does not keep events or colors for pressed and disabled (probably also other colors and values)
    • Copy action bar item doesn't close the action bar (copying itself works though)
    • The action bar items don't all have the same font size, words need more padding
    • Cursor keys don't work in the editor / standalone to move caret
    • Can't use content size fitter as it is possible with Unity (TMP) Input Fields, fields get negative height
     
  12. JasonLam

    JasonLam

    Joined:
    Jun 28, 2020
    Posts:
    1
    1. can it support other non-english characters? such as Japanese?
    I tried on the demos and only see rectangles []
    2. can it support custom font?
    3. can we customize the overlay context menu? ( Cut | Copy ... )
     
  13. zauberzaubar

    zauberzaubar

    Joined:
    Jun 18, 2019
    Posts:
    52
    Another issue: the changed line in PostProcessBuild.cs
     project.AddBuildProperty(target, "OTHER_LDFLAGS", "-force_load $(PROJECT_DIR)/Libraries/AdvancedInputField/Plugins/iOS/NativeKeyboard.a");

    does not match the file location and makes builds fail.
     
  14. ageana

    ageana

    Joined:
    Nov 6, 2013
    Posts:
    23
    I update to the V2 plugin and now I get this compile error:
    Code (CSharp):
    1. Microsoft (R) Visual C# Compiler version 2.9.1.65535 (9d34608e)
    2. Copyright (C) Microsoft Corporation. All rights reserved.
    3.  
    4. error CS1704: An assembly with the same simple name 'Editor' has already been imported. Try removing one of the references (e.g. '/Library/ScriptAssemblies/Editor.dll') or sign them to enable side-by-side.
    5.  
    6. Plugin 'Assets/Plugins/UnityPurchasing/Bin/Editor.dll' has the same filename as Assembly Definition File 'Assets/AdvancedInputField/Editor/AdvancedInputFieldEditor.asmdef'. Rename the assemblies to avoid hard to diagnose issues and crashes.
    7.  
    I am using Unity 2019.4.17f1 on macOS Big Sur.
     
  15. jpienbro

    jpienbro

    Joined:
    Sep 24, 2014
    Posts:
    423
    Version 2.0.1 is pending release on the AssetStore:
    • Bugfix: Fixed skin variations emojis not getting included in emoji asset file
    • Bugfix: Fixed PreferredSize when using autosize on TextRenderers
    • Bugfix: Fixed copy action not hiding ActionBar
    • Bugfix: Fixed hold to show ActionBar
    • Change: Moved doubleTapThreshold & holdThreshold to the Global Settings of the plugin

    NOTE: To get the skin variations emojis included you'll need to run Emoji Generator tool again.


    These are the bugs I could fix this week, I've added the other reported bugs to the Trello board of the plugin
     
    Last edited: Jan 17, 2021
  16. jpienbro

    jpienbro

    Joined:
    Sep 24, 2014
    Posts:
    423
    1. Not at moment yet, but I've added it my TODO list to check if I can support asian languages.
    2. Yes, you can change to font on the TextRenderers you want to use: Unity or TextMeshPro
    3. In the global settings you can change the prefab used for the ActionBar, so you duplicate the existing one and assign the custom one there to use.
     
  17. jpienbro

    jpienbro

    Joined:
    Sep 24, 2014
    Posts:
    423
    Did you remove the files from the old version of the plugin (as mentioned in the "Upgrade Notes" of the Documentation file)?
    "Assets/Plugins/iOS/NativeKeyboard.a" is the old path, the new path is "Assets/AdvancedInputField/Plugins/iOS/NativeKeyboard.a".

    Every file of the plugin is included in the "Assets/AdvancedInputField" directory as of version 2.0.0
     
  18. jpienbro

    jpienbro

    Joined:
    Sep 24, 2014
    Posts:
    423
    Should be fixed in Version 2.0.1 of the plugin, which is currently pending release.
    In the meantime you can fix this manually by selecting the 'Assets/AdvancedInputField/Editor/AdvancedInputFieldEditor.asmdef' file in the Unity Editor and in the inspector change the "name" field to "AdvancedInputFieldEditor".
     
  19. zauberzaubar

    zauberzaubar

    Joined:
    Jun 18, 2019
    Posts:
    52
    Ah well, I guess I didn't. So it's an issue with Unity's limited features of the package format and not in your Asset, cool.
     
  20. BennyTan

    BennyTan

    Joined:
    Jan 23, 2014
    Posts:
    86
    I would just like to say a great big thank you for making version 2 free for users who have purchased version 1!
     
  21. zauberzaubar

    zauberzaubar

    Joined:
    Jun 18, 2019
    Posts:
    52
    I think there is still an issue with PreferredSize. It seems to work fine in SCROLL_TEXT mode. However, we'd like to use it with VERTICAL_RESIZE_FIT_TEXT. This means the text should scale down first and then increase the size of the field. It's a bit specific but we had it working with a normal text mesh pro input before.
     
  22. zauberzaubar

    zauberzaubar

    Joined:
    Jun 18, 2019
    Posts:
    52
    Oh, and I think a null ref check is missing at TMProTextRenderer.cs:221 (I get exceptions there without it)
    Code (CSharp):
    1.                 if (renderer.textInfo != null) {
    2.                     renderer.textInfo.characterInfo = new TMP_CharacterInfo[] {charInfo};
     
  23. zauberzaubar

    zauberzaubar

    Joined:
    Jun 18, 2019
    Posts:
    52
    And another one: I'm trying to make a scroll list with input fields behave the usual: scroll to where the cursor is and also don't hide it with the keyboard. You include a sample but that just scrolls to the field's bottom but that doesn't really work if the text field is not edited at the bottom but somewhere in the middle (and the field is larger than the visible area between keyboard and top of the screen).
    In order to get the currently active TextSelection object to get the visible caret, I'd have to make a lot of fields public and add fields. Could you add a method that just returns the current caret? And while you're at it maybe also methods to get the current selection and make a lot of things readable or public like caret blink time etc. There's no reason these are private and can only be changed in the inspector. That would be very helpful.
     
  24. zauberzaubar

    zauberzaubar

    Joined:
    Jun 18, 2019
    Posts:
    52
    I'm also seeing a lot of deactivated "FrontRenderer" objects pile up, they are apparently created when starting to edit text but not deleting when ending again. I feel like you should start allowing to add tickets somewhere instead of this chaotic forum thread...
     
  25. robert_iadanza

    robert_iadanza

    Joined:
    Mar 19, 2018
    Posts:
    4
    Hi, I'm trying to use the emoji's but I'm getting the following error when I try to run the emoji asset generator:
    TextMeshPro not configured yet, please see the Documentation for instructions

    I checked the TextMesh Pro Settings for Default Sprite Asset (pic included). I'm using Unity 2019.4.13.f1

    Any help would be appreciated.

    Thank you,
    Robert
     

    Attached Files:

  26. zauberzaubar

    zauberzaubar

    Joined:
    Jun 18, 2019
    Posts:
    52
    When setting input field to read only, the caret still appears when clicking, keyboard opens, text can be edited. It is however returned back to what it was before when loosing focus. I would expect the field to behave not like an input field but like a normal text field
     
  27. jpienbro

    jpienbro

    Joined:
    Sep 24, 2014
    Posts:
    423
    Good point. Yes, It's getting a bit messy.

    I've added a github repo to better track bugs and feature requests:
    https://github.com/support-fennecx/advancedinputfield2
    So you can add any unresolved issues to the issues section there.

    Also replaced this Trello link in the first post with above github repo.
     
    Last edited: Jan 24, 2021
  28. jpienbro

    jpienbro

    Joined:
    Sep 24, 2014
    Posts:
    423
    Version 2.0.2 is pending release on the AssetStore:
    • Bugfix: Fixed ConversionTool not copying inherited properties
    • Bugfix: Fixed arrow keys navigation on Standalone when not using emoji support
    • Bugfix: Fixed selection handlers getting recreated on focus
    • Bugfix: Fixed Readonly property still allowing keyboard input
    • Bugfix: Fixed Editor asmdef file
     
  29. jpienbro

    jpienbro

    Joined:
    Sep 24, 2014
    Posts:
    423
    Seems like previous upload to the AssetStore contained a broken/old asmdef file for the Editor specific code (for some versions of Unity). Normally that asmdef should add the correct compiler flags for TextMeshPro.
    This is fixed in version 2.0.2 which is currently pending release on the AssetStore.

    In the meantime you could also fix it yourself by copying the "version defines" of the "Assets/AdvancedInputField/AdvancedInputField.asmdef" file to the "Assets/AdvancedInputField/Editor/AdvancedInputFieldEditor.asmdef" file.
     
  30. jpienbro

    jpienbro

    Joined:
    Sep 24, 2014
    Posts:
    423
    Version 2.0.3 is pending release on the AssetStore:
    • Feature: Added GetCaretTransform() method to get the RectTransform of the caret renderer
    • Bugfix: Added extra null check in TMProTextRenderer in case there isn't a TMP_TextInfo object yet
    • Improvement: Cleanup FrontRenderers from hierarchy view on deselect to avoid cluttering
     
  31. unity_sergigil

    unity_sergigil

    Joined:
    Nov 11, 2019
    Posts:
    11
    Hi! Are you thinking in adding this asset store plugin as a unity package? so we can remove all the code from our base code?
     
  32. rohan_unity697

    rohan_unity697

    Joined:
    Nov 19, 2019
    Posts:
    1
    • Back button does not work when it is long pressed. Stops working after removing certain characters

    • Some characters does not get typed

    • Sometime not able to delete last character if I'm using long back button click
     
    unity_albertosalieto likes this.
  33. unity_albertosalieto

    unity_albertosalieto

    Joined:
    Feb 4, 2021
    Posts:
    1
    Hi, I have exactly the same issues. It happens on an Android device, even in the sample scenes. Pressing the back button removes a few characters and then stops.
     
  34. jpienbro

    jpienbro

    Joined:
    Sep 24, 2014
    Posts:
    423
    Version 2.0.4 is pending release on the AssetStore:
    • Bugfix: Fixed race condition in native iOS and Android code caused by long pressing backspace key
    • Bugfix: Fixed error when calling RefreshOriginalContentSize() on KeyboardScroller when it's not initialized yet
    • Change: Moved menu items under "Tools" in the TopBar
    • Improvement: Added extra safety checks to ensure a new instance of the NativeKeyboardManager won't be created when some code is trying to access it when exiting play mode in the Editor
     
    unity_albertosalieto likes this.
  35. YamatoKuroiwa

    YamatoKuroiwa

    Joined:
    Feb 3, 2021
    Posts:
    2
    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:

  36. kyjv

    kyjv

    Joined:
    Feb 20, 2018
    Posts:
    9
    I'm not sure if Unity is behaving weird but when I install 2.0.4 I don't see any changed files compared to 2.0.3 (in git)
    Edit: Unity was weird, works fine now
     
    Last edited: Feb 13, 2021
  37. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    6
    I didn't know the soft keyboard had arrow keys too (I thought only the hardware keyboards for Android). Seems like not all stock keyboards have them, but I've noticed SwiftKey keyboard has them (and GBoard in a submenu).
    So I've modified the plugin to check for text selection changes caused by pressing those arrow keys.

    This should fix it:
    Replace the NativeKeyboard.aar file in Assets/AdvancedInputField/Plugins/Android with the one in attached zip file
     

    Attached Files:

  38. stansison

    stansison

    Joined:
    Feb 20, 2016
    Posts:
    26
    Just purchased the plugin. I’m working on integrating it into my app and have run into some hitches.
    I used inputfield.isFocused, inputfield.shouldHideMobileInput and inputfield.ActivateInputfield. Does advanced inputfield have ways to access those same properties/functions?
     
  39. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    6
    inputField.isFocused => inputField.Selected
    inputField.shouldHideMobileInput => Not available, basically always true on Android & iOS. This plugin doesn't render a native inputfield above the keyboard
    inputField.ActivateInputField => inputField.ManualSelect()
     
  40. unity_sergigil

    unity_sergigil

    Joined:
    Nov 11, 2019
    Posts:
    11
    Hi @fennecx_support

    I have a design question related to the advanced input field....

    We want the input text to accept line breaks, so we have enabled the VERTICAL_RESIZE_FIT_TEXT Mode and this is working so the text growths in height.

    Right now we have added a Line Limit of 4 but the text keeps growing in height, not taking into account this 4 lines limit... so here there are my questions:
    1. Is there a way to use this Line Limit with the VERTICAL_RESIZE_FIT_TEXT Mode?
    2. Is there a way to have a maximum growth in height of 4 lines using VERTICAL_RESIZE_FIT_TEXT and at that point start using the SCROLL_TEXT? this way we can control the maximum size of the input, if not in mobile people could start trolling the app and write a lot of returns so the input text will growth with no control
    Thanks in advance!

    Sergi
     
  41. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    6
    Version 2.0.5 is pending release on the AssetStore:
    • Bugfix: Fixed text selection changes caused by arrow keys on Android soft keyboard are not detected
    • Bugfix: Fixed line limit property not working properly
    • Feature: Added ResizeMaxWidth and ResizeMaxHeight properties to be used with the resize modes. Will automatically start scrolling the text when max width/height has been reached
     
  42. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    6
    1. I've verified that the line limit property didn't work properly, so I've added a fix for that in the next version
    2. I first tried to implement this behaviour with the line limit property, but then it would not really be clear there is more text, basically it would precisely fit those exact amount of lines. So, I've added 2 new properties:ResizeMaxWidth and ResizeMaxHeight to be used with HORIZONTAL_RESIZE_FIT_TEXT and VERTICAL_RESIZE_FIT_TEXT. When setting the ResizeMaxHeight property to something else than zero it will start scrolling the text whenever it exceeds that max value.
    In your case you can set that max height to something a bit more than 4 lines of height, so you would see part of the 5th line (when available). When you delete (part of the) text again and the height of the text gets smaller than the max height it will shrink again.

    Both changes are included in the next release of the plugin (2.0.5). This version is currently pending release in the AssetStore. Usually they approve it within 24 hours.
     
  43. unity_sergigil

    unity_sergigil

    Joined:
    Nov 11, 2019
    Posts:
    11
  44. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    990
    Hi we are having an issue where the mobile selection cursors are showing up in our desktop editor and desktop builds. I made sure global settings for desktop had Touch text selection Allowed is disabled. Using release 2.0.5

    Edit: Some further info when the action bar is allowed but "Touch Text Selection Allowed" is disabled there are times where the mobile selection cursors are still visible.

    On our desktop platforms we still want to select text but we do not to want to see the teardrops

    EDIT: I found this code


    Code (CSharp):
    1.                 if(InputField.CanUseTouchSelectionCursors || InputField.CanUseActionBar)
    2.  
    which I changed to

    Code (CSharp):
    1.                 if(InputField.CanUseTouchSelectionCursors && InputField.CanUseActionBar)
    2.  
    This helps but now I do not see any insert cursor until i start typing in a field
     
    Last edited: Mar 2, 2021
  45. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    990
    Found another issue with the password field. If we create a AIF TextMeshPro InputFfield and set to password the input is not obfuscated. Visible password setting also has no effect. I added a test field to the Modes sample app to test.

    I confirmed a TextMeshPro standard input field set as password working as expected

    Edit confirmed this was due to emoji being on.

    Code (CSharp):
    1.         public bool ShouldUseRichText
    2.         {
    3.             get { return (richTextEditing || emojisAllowed); }
    4.         }
    Suggestion if field type == PASSWORD automatically disable richtext/emoji's
     
    Last edited: Mar 2, 2021
  46. gouasmimedlotfi

    gouasmimedlotfi

    Joined:
    Oct 13, 2019
    Posts:
    4
    I have a problem :
    i created a form inside a scrollview and set up a keyboard scroller and everything
    and the inputs are inside a loyout group, my problem is that all inputfields work but one, the one that doesn't is the only one set on MULTILINE_NEWLINE, for this it seems that container's height is set to 0 for some reason, the text is there, but not apearing (as Text is not enabled).
    i've also seen this behaviour when i use an input field in a prefab (also using layout group)

    is there any way to fix this ?
     
  47. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    6
    Are you talking about this single cursor teardrop?
    upload_2021-3-7_14-35-38.png

    Because for actual text selection they are not visible if I disable the "TouchTextSelectionAllowed" option in the Global Settings
    upload_2021-3-7_14-37-18.png
     
  48. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    6
    Not really sure why that would happen when the inputfield is set to MULTILINE_NEWLINE, but I've made a modified version of the "Form" sample scene that uses a VerticalLayoutGroup and in that scene the multiline inputfield (comments) still works.
    I've attached the scene file, so hopefully this will useful to see how I configured the GameObjects.
     

    Attached Files:

  49. lrtrime

    lrtrime

    Joined:
    Sep 16, 2020
    Posts:
    2
    Hello!

    I just downloaded this asset but when I go straight to the demo scene "Form" and compile it to my iPhone 12 Pro (not a slow device), I am chocked by how slow the form is. I was expecting something running smooth, but everything is laggy. I have compiled in release mode yes.

    Is that how it is on your side too? Because to me, this is not acceptable at all for a great user experience...

    Thanks for your input!
     
unityunity