Search Unity

Advanced Input Field 2

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

  1. Seb_L

    Seb_L

    Joined:
    Feb 17, 2021
    Posts:
    16
    Hello, Thank you for your changes.
    When I update, i have the same Installation Problem.
    And when i Import the Package, only Prefabs can be checked.
     
  2. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    133
    Version 2.0.8 is pending release on the AssetStore:
    • Bugfix: Fixed several ActionBar sizing issues on Tablets
    • Feature: Added IconButtonPadding and MinItemWidth properties on ActionBar
    • Change: Changed default InputField prefab settings, so the advanced options are not enabled by default
     
  3. Seb_L

    Seb_L

    Joined:
    Feb 17, 2021
    Posts:
    16
    It's a unity Problem.
    I delete the Package from C:\Users\USERNAME\AppData\Roaming\Unity\Asset Store-5.x and then i can download it normaly. Now it works.
     
  4. Seb_L

    Seb_L

    Joined:
    Feb 17, 2021
    Posts:
    16
    I have a problem with decimal validation.
    In German, in the Standard Unity Input Field, wenn i give DecimalNumber as Content Type, i can enter numbers and comma.
    With the Advanced Input Field, i can only enter numbers and dot.
    That not correct !
     
  5. Seb_L

    Seb_L

    Joined:
    Feb 17, 2021
    Posts:
    16
    Another Problem.
    If the Input Field, is not visible at begin, the Start function of SimulatorKeyboard is not fired. I receveid a nullpointerexception on ShowKeyboard because textValidator is null.
     
  6. Seb_L

    Seb_L

    Joined:
    Feb 17, 2021
    Posts:
    16
    Hello,

    Wenn i use the Advanced Input Field, i have also this error when I close the play Modus in Unity :

    Some objects were not cleaned up when closing the scene. (Did you spawn new GameObjects from OnDestroy?)
    The following scene GameObjects were found:
    NativeKeyboardManager
    Keyboard
    Label
    SpaceButton
    CharacterRow4
    BottomRow
    Label
    DoneButton
    Icon
    BackspaceButton
    DotButton
    CommaButton
    Label
    CharacterRow3
    CharacterRow4Special
    Icon
    Label
    SymbolsButton
    Label
    Icon
    CharacterRow1
    ShiftButton
    CharacterRow2
    PortraitKeyboardCanvas(Clone)


    What should I do ?
     
  7. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    133
    Valid point, I've added it to the issue tracker: https://github.com/support-fennecx/advancedinputfield2/issues/31
    Probably will include it in next release
     
  8. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    133
    Are you trying to select the inputfield from code when it has not been active before?
     
  9. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    133
    Normally this happens if the NativeKeyboardManager is being recreated because something is calling a method or accessing a property in OnDisable() or OnDestroy() (when stopping Editor) and the singleton instance already has been destroyed. Those static methods in the NativeKeyboardManager class should call ValidateInstance() first to check for Editor closing, so it's strange that you still get that error.
    Can you see in the stack trace what line of code is accessing NativeKeyboardManager (and is generating that error)?
     
  10. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    133
    Another user reported an issue with the newer versions of the plugin that the text edit state didn't correspond with the internal state when reselecting an input field. (for example: when reselecting inputfield the caret is visible at the end of text, but when typing you notice it's actually at the start).

    Here's the patch package to resolve the issue.
     

    Attached Files:

  11. Seb_L

    Seb_L

    Joined:
    Feb 17, 2021
    Posts:
    16
    Hello, yes the InputFiled is on a not active Panel. I activ the Panel and then call ManualSelect(). This give the error.
     
  12. Seb_L

    Seb_L

    Joined:
    Feb 17, 2021
    Posts:
    16
    Nothig more in the stack trace.

    But just after i have also this error :
    EndLayoutGroup: BeginLayoutGroup must be called first.
    UnityEngine.GUIUtility: ProcessEvent(Int32, IntPtr, Boolean&)


    No more details.
     
  13. Seb_L

    Seb_L

    Joined:
    Feb 17, 2021
    Posts:
    16
    I have it only when i use IOS in Unity, not with Android.
     
  14. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    133
    Version 2.0.9 is pending release on the AssetStore:
    • Bugfix: Fixed issue that the text edit state was not getting synced properly with native code when reselecting an input field
    • Change: Split Decimal character validation into DECIMAL and DECIMAL_FORCE_POINT. DECIMAL will allow both dot and comma character as the decimal separator and DECIMAL_FORCE_POINT will automatically convert comma characters to a decimal point/dot character
    • Bugfix Android: Fixed issue on Android that keyboard was not closing when pausing app
    • Bugfix Android: Fixed issue that keyboard restore didn't work correctly on some Android devices after resuming app
    • Bugfix Editor: Fixed SimulatorKeyboard error when selecting InputField (from code) immediately in Awake()
     
  15. 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.
     
  16. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    133
    I did a quick google to get the displayed suggestions from the keyboard, but found this topic: https://stackoverflow.com/questions...-get-the-suggestions-from-keyboard-in-android
    which says it's not possible due to privacy.

    If you want to implement your own word list and spellchecker, I suggest you take a look at the "SpellChecker" scene in the Samples folder. In this scene incorrect words get underlined and when tapping them a replace option will appear in the ActionBar.
     
  17. Yi-GPS

    Yi-GPS

    Joined:
    Jan 21, 2020
    Posts:
    5
    Hi @fennecx_support Unfortunately we need to have emoji support so that's not an option for us. I would also like to report that LiveDecorationFilter does not work with TMP and the "EmojisAllowed" box checked. All input will result in an empty string. This is also a feature we are planning to use as well.
     
  18. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    133
    I've managed to implement an word replacement check in the RichTextProcessor, (needed for rich text/emoji support) which seems replace the word correctly most of the times when selecting one of the suggestions on the keyboard.
    See attached file.

    What is your use-case exactly for needing LiveDecorationFilters and emoji support at the same time?
    I mainly intended LiveDecorationFilters to be used for basic visual formatting such as a date and a credit card number input. Combining that with RichText/Emoji support adds an extra layer of complexity.
     

    Attached Files:

  19. Seb_L

    Seb_L

    Joined:
    Feb 17, 2021
    Posts:
    16
    Hello,
    Can you also include the Decimal Pad (DECIMAL_PAD) in a future Version ?
    Thank You

    EDIT : Number and Punctuaction give me the decimal Pad. Und the real Number and Punctuation are not present. Can you change it like unity ?
     
    Last edited: Apr 26, 2021
  20. Yi-GPS

    Yi-GPS

    Joined:
    Jan 21, 2020
    Posts:
    5
    Thank you @fennecx_support I will give it a try!

    We want emoji support but we don't want the user to be able to input other RichText in the input field. So I'm thinking to remove other tags that the user may have entered in the filters. Is there a better way of doing it?
     
  21. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    133
    I never noticed that nor did anyone report this before, but you are right. They are 2 different keyboard types, at least on iOS.
    I've added it to the issue tracker: https://github.com/support-fennecx/advancedinputfield2/issues/34
     
  22. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    133
    Seems like TextMeshPro doesn't provide an easy way to only allow sprite tags. (according to this topic: https://forum.unity.com/threads/removing-rich-text-tags-from-a-string.530360/)
    So I've used a LiveProcessingFilter to detect & remove rich text tags from the raw text edit change. LiveProcessingFilters can be seen as a man in the middle between the native keyboard changes and the other C#/Unity code of the AdvancedInputField.
    See included package where I configured the filter in the "Chat" sample scene.
     

    Attached Files:

  23. Splint-L

    Splint-L

    Joined:
    Feb 6, 2018
    Posts:
    3
    Hi

    I'm really liking the asset so far but I'm having a problem and I think it might be related to the bugfix in the last update.
    • Bugfix: Fixed issue that the text edit state was not getting synced properly with native code when reselecting an input field
    At least it sounds like it might be related to what I'm experiencing. I can easily trigger it in the unity editor even. All I have to do is input some text, delete it and repeat enough times. After a few times normally there will be a string "stuck" in the input field and it's become un-editable. This is the case both in Unity Editor and on iOS and Android builds.

    I'm am however on version 2.0.9, so.... Maybe the issue wasn't quite fixed or it's something else entirely...


    ---- Update:

    I've looked more into the problem now, and I can say that it's not really your input fields fault after all... I had code that changed the "Text" of the input field while the user was entering text... It didn't like that - but that almost understandable... - However I might add that Unity's standard input field was able to handle that behaviour, so maybe that could be a future improvement for your asset :)
     
    Last edited: Apr 28, 2021
  24. Seb_L

    Seb_L

    Joined:
    Feb 17, 2021
    Posts:
    16
    The problem is that on IOS, the Decimal Pad has not a Validate Button (or maybe there is something i don't know), and the Number and Punctuation Pad, has a Validate Button. In my case i need a validate button.
     
  25. visualjoy

    visualjoy

    Joined:
    Aug 23, 2016
    Posts:
    38
    Hi, I'm having some problems while trying to get the keyboard height. Here's my code:
    Code (CSharp):
    1. NativeKeyboardManager.AddKeyboardHeightChangedListener((height) =>
    2.         {
    3.             float trueHeight = height /  Canvas.scaleFactor;
    4.         });
    It works fine on the editor, but on Android it returns a different value that is a little bit higher than the actual height.
     
  26. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    133
    Version 2.0.10 is pending release on the AssetStore:
    • Bugfix: Fixed suggestions on native keyboard not correctly getting applied when using RichText/Emoji support
    • Bugfix: Fixed issue that the caret was getting rotated in world space if the target camera of the Canvas was rotated (for example in AR)
    • Feature: Added the BlockRichTextTags LiveProcessingFilter to block rich text tags from being inserted by the user (for example when using emoji support)
    • Bugfix Mobile: Corrected Decimal & Numbers and Punctuation keyboard types on Android & iOS
     
  27. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    133
    Not really sure I can improve this further on Android. The problem is that Android doesn't actually have an API to get the keyboard height, so most workarounds involve comparing size changes between native views. This seems to give a height value (in screen pixels) close to the actual value. At least on the Android devices I've tested on.
     
  28. Dev_WeAR-Studio

    Dev_WeAR-Studio

    Joined:
    Nov 26, 2015
    Posts:
    3
    Can you provide realisation of this variable?)
     

    Attached Files:

  29. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Ah, yes, probably forgot to port those variables completely from the old AdvancedInputField 1 system. I've fixed them in the attached files.
     

    Attached Files:

  30. xAvatarchikx

    xAvatarchikx

    Joined:
    Aug 17, 2012
    Posts:
    69
    Hi!

    When you pause, you need to check if the input is currently selected, otherwise if I press Done and at this moment show the native popup, when I close the keyboard is shown again

    add (InputField.Selected)

    internal void OnApplicationPause(bool pause)
    {
    if(pause)
    {
    if(Time.realtimeSinceStartup - lastTimeSelected <= 1 && InputField.Selected) //Check if this was inputfield was selected within last second
    {
    NativeKeyboardManager.ActiveInputFieldBeforePause = InputField;
    }
    }
    }
     
  31. Sergey-Leluk

    Sergey-Leluk

    Joined:
    Mar 4, 2015
    Posts:
    8
    Hello, I've got some exception

    AndroidJavaException: java.lang.ClassNotFoundException: com.jeroenvanpienbroek.nativekeyboard.InativeKeyboardCallback

    I found the code that is the cause of the problem

    public AndroidKeyboardProxy(AndroidKeyboard keyboard) : base("com.jeroenvanpienbroek.nativekeyboard.INativeKeyboardCallback")
    {
    this.keyboard = keyboard;
    }


    The problem appears only on Android. iOS works well.

    AdvancedInputField 2- Version 2.0.10 - May 05, 2021
    Unity - Version 2020.3.11f1


    Could you, please, help me.
     
    AlekseevAV likes this.
  32. xAvatarchikx

    xAvatarchikx

    Joined:
    Aug 17, 2012
    Posts:
    69
    Hi!
    If I use LiveDecorationFilter then when clearing
    AdvancedInputField.Clear () ;,
    the component is not cleared, you need to select an input then cleansing will occur
     
  33. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Normally this code was needed for autofill, because the app gets paused and resumed for a second when autofilling the inputfield. If you manually call some code to show your native popup when done key is pressed, you can try to call ManualDeselect() on the inputfield to Unfocus/Deselect the inputfield before showing the native popup.
     
  34. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Not really sure what's happening here, but usually a ClassNotFoundException means that the Android library file isn't getting included in the build properly. The path to Android library file of the plugin is: Assets/AdvancedInputField/Plugins/Android/NativeKeyboard.aar.
    So maybe verify if the file is there and otherwise try to reimport to plugin. Also verify that you don't have any stripping settings enabled in Unity that might remove the file while building.

    I've also just tested this in Unity 2020.3.12 in a clean Unity project with only the plugin installed. Made a build with the "Form" sample scene and ran it on my Android device and that works for me.
     
  35. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    I could reproduce and fix the bug.
    To fix change the SetText method in AdvancedInputField.cs to this:

    Code (CSharp):
    1. public void SetText(string text, bool invokeTextChangeEvent = false)
    2. {
    3.     if(text == null) { text = string.Empty; }
    4.  
    5.    if(this.text != text)
    6.    {
    7.       Engine.SetText(text);
    8.       Engine.SetSelection(0, 0);
    9.  
    10.       if(Application.isPlaying)
    11.       {
    12.          if(ShouldUseRichText)
    13.          {
    14.             Engine.RichTextProcessor.SetupRichText(text);
    15.             Engine.SetRichText(text);
    16.             Engine.SetRichTextSelection(0, 0);
    17.          }
    18.          else if(LiveDecoration)
    19.          {
    20.             string processedText = LiveDecorationFilter.ProcessText(Text, CaretPosition);
    21.             if(processedText != null)
    22.             {
    23.                Engine.SetProcessedText(processedText);
    24.                Engine.SetProcessedSelection(0, 0);
    25.             }
    26.          }
    27.          else if(PostDecoration && !Selected)
    28.          {
    29.             if(PostDecorationFilter.ProcessText(Text, out string processedText))
    30.             {
    31.                Engine.SetProcessedText(processedText);
    32.                Engine.SetProcessedSelection(0, 0);
    33.             }
    34.          }
    35.       }
    36.    }
    37. }
     
  36. Soulside

    Soulside

    Joined:
    Nov 1, 2018
    Posts:
    30
    Hi,

    I'm using version 2.0.9. On iOS, none of the character validators are working. I've tried adding them in my own scenes and tried the CharacterValidator scene included in the samples. Validators are working fine in the editor and on Android.
    Can you please verify that the validators are working on iOS?

    Thanks
     
  37. elhongo

    elhongo

    Joined:
    Aug 13, 2015
    Posts:
    47
    Hello,
    I just bought this asset and replaced one instance of the Unity InputField (multiline) that we wanted to edit directly on our screen, and not in the native keyboard text field.
    For Android, everything works pretty well except for:
    - some weird initial cursor position on the empty field. It's not centered on top as expected, midway to the left actually.
    For iOS, another bug happens:
    - cannot delete the last character with backspace!

    I might miss some proper configuration, but they seem just bugs to me...
    Any help is welcome. Consider we have a tight schedule for a delivery right now.
    Pablo.
     
  38. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    133
    Could reproduce and fix the issue. (Was caused by a small typo in native iOS code)
    To fix replace the NativeKeyboard.a file in Assets/AdvancedInputField/Plugins/iOS with the one in attached zip.
     

    Attached Files:

  39. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    133
    1. Could reproduce the issue when setting text alignment to center on Text & Placeholder TextRenderers and making the Placeholder text completely empty. (I guess this is your setup)
    This issue usually occurs because the Unity Text Renderer is giving wrong positions when the text is completely empty, so a quick fix it to just set the "Placeholder Text" property to an empty space character " ".

    2. Couldn't reproduce this issue on iOS, tested this with the sample scene "Form" (using version 2.0.11 of the plugin) and running it on my iPhoneXS. Tried typing and deleting everything again multiple times in different fields.
     
  40. elhongo

    elhongo

    Joined:
    Aug 13, 2015
    Posts:
    47
    Thanks for the quick response.

    Issue 1. Your workaround did the trick.
    Issue 2. We definitely solved at some point, not sure how though (not sure what was causing this issue at some point).

    There is a 3rd issue we found now on both iOS/Android:
    We have 10 max lines specified in the AdvancedInputField. But when the user types passed them, then he has to backspace everything typed instead of just erase the last visible character.

    Thanks again.
     
  41. itsnottme

    itsnottme

    Joined:
    Mar 8, 2017
    Posts:
    129
    Hello, I am having trouble with one of the inputfields in my project.
    Here's a gif showing the problems.
    gif.gif

    When creating a new line, the text does not move properly until new text is typed in the line. (also same problem when removing a line)

    Also, the placeholder changes to the first letter typed and not stay the same.

    I attached a prefab of the inputfield.
     

    Attached Files:

  42. itsnottme

    itsnottme

    Joined:
    Mar 8, 2017
    Posts:
    129
  43. Soulside

    Soulside

    Joined:
    Nov 1, 2018
    Posts:
    30
    Thank you for fixing the issue, but now I have another issue.

    The plugin is not working with Unity Cloud Build. The reason might be that Unity Cloud Build is still using xCode 12.4 whereas the plugin might be compiled with a later version of xCode, but I'm not sure. I know that the plugin version 2.0.9 works with Unity Cloud Build.

    Can you please provide a fix?
     
  44. itsnottme

    itsnottme

    Joined:
    Mar 8, 2017
    Posts:
    129
    I also found 2 other bugs, but these only happen on build (android) and not in editor.

    Editing an inputfield will pull the screen down. (even if no keyboardScroller/ScrollView):
    Screenshot_20210729-133005_Dating App.png
    Screenshot_20210729-133011_Dating App.png

    Also, when using a KeyboardScroller:
    On Android build:
    Screenshot_20210729-133609_Dating App.png
    Screenshot_20210729-133615_Dating App.png

    On Editor (works properly):
    Editor.PNG
     
    Last edited: Aug 8, 2021
  45. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    133
    Sorry for the late response.
    I've tried to reproduce your issue with provided prefab, but got some issues with broken references (for Unity UI components). So I used that Chat sample scene and copied the settings of your AdvancedInputField instance and applied to the inputfield in that scene.
    1. I could not reproduce the issue with the incorrect spacing when typing a newline. Maybe just check how I added the default padding (between text and bounds) in the Chat sample scene. I've only modified the anchor settings (from the sides) on the "TextArea" child object.
    2. I could reproduce the placeholder issue. Was an incorrect text set by the line limit method. To fix change the method "ApplyLineLimit" in InputFieldEngine.cs to this:

    Code (CSharp):
    1. internal bool ApplyLineLimit(TextEditFrame textEditFrame, out TextEditFrame resultTextEditFrame)
    2. {
    3.        resultTextEditFrame = textEditFrame;
    4.  
    5.        TextRenderer activeTextRenderer;
    6.        if(InputField.LiveDecoration || (!InputField.Selected && InputField.PostDecoration))
    7.        {
    8.               activeTextRenderer = InputField.ProcessedTextRenderer;
    9.        }
    10.        else
    11.        {
    12.               activeTextRenderer = InputField.TextRenderer;
    13.        }
    14.  
    15.  
    16.        string text = textEditFrame.text;
    17.        activeTextRenderer.Text = text;
    18.        activeTextRenderer.UpdateImmediately();
    19.  
    20.        if(activeTextRenderer.LineCount > InputField.LineLimit && text.Length > 1)
    21.        {
    22.               int selectionStartPosition = textEditFrame.selectionStartPosition;
    23.               selectionStartPosition--;
    24.  
    25.               EmojiData emojiData;
    26.               if(InputField.EmojisAllowed && NativeKeyboardManager.EmojiEngine.TryFindPreviousEmojiInText(text, selectionStartPosition, out emojiData))
    27.               {
    28.                      int count = emojiData.text.Length;
    29.                      text = text.Remove(selectionStartPosition + 1 - count, count);
    30.                      selectionStartPosition -= (count - 1);
    31.               }
    32.               else
    33.               {
    34.                      text = text.Remove(selectionStartPosition, 1);
    35.               }
    36.  
    37.               textEditFrame.text = text;
    38.               textEditFrame.selectionStartPosition = selectionStartPosition;
    39.               textEditFrame.selectionEndPosition = textEditFrame.selectionStartPosition;
    40.               ApplyLineLimit(textEditFrame, out resultTextEditFrame); //Try again to stay within line limit
    41.               return true;
    42.        }
    43.  
    44.        return false;
    45. }
     
  46. itsnottme

    itsnottme

    Joined:
    Mar 8, 2017
    Posts:
    129
    Thanks for the response.

    1. Changing the TextArea or the Content settings to that of the chat inputField did not fix the issue.
    Which references were broken in the Prefab?

    2. Thanks, that fixed it.
     
  47. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    133
    I've attached a new iOS library file build using XCode 12.4. Hopefully this fixes your issue.
     

    Attached Files:

  48. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    133
    I guess you are using a specific fullscreen mode flag on Android, based on your screenshots.
    Some devices react differently to those fullscreen mode flags when the keyboard appears. For Xiaomi (and possibly other devices) there was some code added to force the bottom navigation bar visible when the keyboard appears, otherwise it would cause glitches. (When keyboard hides it should restore the flags).

    Could you provide me following information:
    - The specific fullscreen mode flag you are setting in code or in a custom AndroidManifest file
    - The device that this happens on

    I'll see if I can reproduce it then.
     
  49. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    133
    The broken references were all Unity UI components, so could you provide me the specific Unity version you are using? But first, could you verify if the Chat sample scene works correctly (with the newlines) in your project? It should work similarly to your setup.
     
  50. itsnottme

    itsnottme

    Joined:
    Mar 8, 2017
    Posts:
    129
    1. I attached my manifest. Also, I am using this plugin to show the status bar and navigation bar https://github.com/Over17/UnityShowAndroidStatusBar
    So Fullscreen is disabled.
    I also attached the aar I am using for the bars.
    2. Samsung S9+
     

    Attached Files: