Search Unity

Advanced Input Field

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

  1. SanSan13ss

    SanSan13ss

    Joined:
    Aug 29, 2019
    Posts:
    6
    Hello. Thank you for the plugin. We use it but we faced on some difficulties when we tried to use it on android devices (models that don't have any buttons such as HOME, BACK, HIDE). When I press ENTER, when the native keyboard appears, there's an ACTIONBAR which is not necessary at that moment. (Which contains such buttons as HOME, BACK, HIDE). This ACTION BAR isn't transparent, but has this active set. And for the next showing it's still not transparent and doesn't hide.
     
  2. bakno

    bakno

    Joined:
    Mar 18, 2007
    Posts:
    604
    Hi

    We have purchased this asset as well after trying the Chat sample apk, because we are building a chat interface and we need two simple things that work on the sample chat:

    - Keep the keyboard open after submission
    - Showing a custom mobile input field over the keyboard so we can show a custom Submit button.

    After installing and playing around with the asset, we have not been able to make it work. Creating a new Advanced Input Field creates many unnecessary objects to the scene like the soft-keyboard. Additionally this new field has many objects in its structure that we don't need, for example the scrolling view and all its objects, however if we remove them the field does not work.

    We kept the field intact, and selected "Single Line" as the Line Type. Now the whole field gets automatically resized while writing in it, and we have not been able to make it keep a fixed size.

    We have not worked yet on resizing the chat window when the keyboard is visible but it should be managed by the AddKeyboardHeightChangedListener. Correct?

    Now, the most important part. When running the project on an Android device, the keyboard gets hidden after submission. Our "Send" UI button receives the tap but the keyboard is hidden.

    Thank you in advance
     
  3. bakno

    bakno

    Joined:
    Mar 18, 2007
    Posts:
    604
    Hi again

    After more hours with trial and error we found a solution to most of our issues:

    - Selecting vertical_resize_fit_text and multiline_new_line was the right setup for our project.
    - Resizing the chat panel was done using the OnKeyboardHeightChanged function.
    - The keyboard is not hidden if we place the "Send" button inside the advancedinputfield rect (and hierarchy).
    - Selection tool seems to be activated the first time you tap the field. We decided not to use this tool

    Now, we would like to have a cosmetic fix I hope someone can give us some guidance on how to achieve it:

    - The Text line is vertically centered (aligned with the placeholder text), but when you enter a single character, it turns into a bigger text area vertically aligned at the top. Is it possible to get this switch only when the written text is two lines? And get it back to original when it is a single line?

    Thank you
     
  4. bakno

    bakno

    Joined:
    Mar 18, 2007
    Posts:
    604
    I think I got it...

    On the AdvancedInputField.cs script, replace line 1699 by this...

    case TextAlignment.TOP_LEFT: anchor = new Vector2(0, 0.5f); break;

    Now a final question. Is there a way to simplify all the assets imported. Most likely we just need a couple of scripts. Can someone point to those that are the necessary ones?

    Thanks
     
  5. Jochanan

    Jochanan

    Joined:
    Nov 9, 2016
    Posts:
    85
  6. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Looks like there are still some coroutines active on the NativeKeyboardManager instance when switching scenes. The coroutines all run on that instance (that is always active) to make sure coroutines still get executed when an inputfield is disabled.
    Seems like the error can be triggered by switching to the next scene immediately or a few frames after the inputfield has been created/initialized.

    Adding an extra check in those coroutines should fix it:
    upload_2019-9-8_15-2-39.png
    In AdvancedInputField.cs below every line that says "yield return null" add "if(this == null) { yield break; }".
     
    Jochanan likes this.
  7. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    The Chat sample scene should show the instructions the configure TextMeshPro Text renderers (if they are not configured properly yet). (Also in the ReadMe)
    If the text is visible in that scene, it means TextMeshPro is properly configured.

    To make emojis visible in that scene, make sure you have the TextMeshPro Essentials installed (TopBar: Window => TextMeshPro => Import TMP Essential Resources).
    NOTE: Scripting Define Symbols in the PlayerSettings of Unity are platform specific
     
  8. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    I couldn't play the video for some reason, but that actionbar is visible when keyboard appears, because I've noticed problems with certain Xiaomi devices (might be others too) that causes glitches when that actionbar gets forced hidden when using fullscreen mode. When those devices get those glitches they still occupy that actionbar area below the keyboard (and have invisible semi-working buttons).
     
  9. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Most of the scripts reference each other, but if you want to remove some assets these should be safe to remove:
    - Prefabs/CharacterValidation directory
    - Prefabs/LiveProcessing directory
    - Prefabs/PostProcessing directory
    - Samples directory
    - Scripts/LiveProcessing/CreditCardFilter.cs
    - Scripts/LiveProcessing/DateFilter.cs
    - Scripts/PostProcessing/DollarAmountFilter.cs
    - Scripts/PostProcessing/DollarDecimalFilter.cs
    - Scripts/PostProcessing/PasswordFilter.cs
     
  10. SanSan13ss

    SanSan13ss

    Joined:
    Aug 29, 2019
    Posts:
    6


    I'm sorry! Here is a video. Plz, try again.


    BTW, have u found any ways to solve this issue?
     
  11. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Ah, OK, that video makes the issue more clear. Didn't know you were using the keyboard in landscape mode. I can understand that the action bar is annoying in landscape mode.
    I'll try to change the action bar settings tomorrow (don't have all my test devices with me atm) and see if I can find a setting that keeps it hidden in landscape mode and also works on the Android devices that were causing glitches before.
     
  12. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    I changed the settings to keep the action bar hidden in landscape mode and seems to work on my test device.
    Replace the file NativeKeyboard.aar in Assets/Plugins/Android with the one in attached rar file.
     

    Attached Files:

  13. SanSan13ss

    SanSan13ss

    Joined:
    Aug 29, 2019
    Posts:
    6
    Thank. I will try
     
  14. unity_Sibbu

    unity_Sibbu

    Joined:
    Feb 6, 2019
    Posts:
    9
    i am using IFPassword.ForceLabelUpdate() while i was using normal inputfield, but what to do while using advanced input field.
     
  15. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    If you want to toggle the visibility of the password this should work:

    Code (CSharp):
    1. if (passwordInput.ContentType == ContentType.Password)
    2. {
    3.     passwordInput.ContentType = ContentType.Standard;
    4. }
    5. else
    6. {
    7.     passwordInput.ContentType = ContentType.Password;
    8. }
     
  16. unity_Sibbu

    unity_Sibbu

    Joined:
    Feb 6, 2019
    Posts:
    9
    in unity editor its working fine. but in mobile sometime advance input field not working. while typing its not allow to type. what should i do
     
  17. unity_Sibbu

    unity_Sibbu

    Joined:
    Feb 6, 2019
    Posts:
    9
    Its work fine in unity editor but not in android or ios mobile devices
     
  18. unity_Sibbu

    unity_Sibbu

    Joined:
    Feb 6, 2019
    Posts:
    9
  19. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    The link seems to give me a permission denied error.
    Anyways I just tested the plugin in an empty/clean Unity project with latest version from the Asset Store (1.9.1):
    Added the sample scene "Form" to the build settings and made a build for my Android device.
    Everything seems to work normally in that build.

    Could you also try this in an clean Unity project and see if the issue still occurs?
    Also, could you check if there are any errors in the log of your existing build, maybe something else is conflicting?
    Are you using something unofficial on your Android device, for example a custom rom or a third-party keyboard?
    Not sure if it matters, but what Unity version are you using currently?
     
  20. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Patch package for version 1.9.1 of the plugin to fix caret position issues when toggling password visibility by changing the ContentType on runtime on some platforms.
    Also, added an example of password toggle to the "Form" sample scene in this patch package
     

    Attached Files:

  21. unity_Sibbu

    unity_Sibbu

    Joined:
    Feb 6, 2019
    Posts:
    9
    I am using my project for webgl and I want this touch screen keyboard on that also. Is that possible from this plugins
     
  22. unity_Sibbu

    unity_Sibbu

    Joined:
    Feb 6, 2019
    Posts:
    9
    what to use for advanceinputfield instead of this
    mainInputField.DeactivateInputField();

    please help me as soon as possible
     
  23. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    WebGL isn't one of the supported platforms of the plugin. A user did report that he got keyboard input working in WebGL on standalone platforms after after adding || UNITY_WEBGL preprocessor to all the places in the plugin code where the UNITY_STANDALONE preprocessor is used, but I haven't tested this. Native Android/iOS keyboard probably won't work. You might be able to make a touch screen keyboard work in WebGL by modifying the SimulatorKeyboard (that is a keyboard implemented using the Unity Canvas).
     
  24. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    You can use the method "inputField.ManualDeselect()" if you want to deselect the inputfield (and hide the keyboard on mobile platforms).
     
  25. takoy

    takoy

    Joined:
    Jul 2, 2015
    Posts:
    20
    Is it possible using your package to take out the strip above the iOS keyboard?
    I would like to have my own custom box appearing above it, and the "cancel", "done" buttons are ruining my UI design :(


    IMG_6214.jpg
     
  26. DORNE

    DORNE

    Joined:
    Jul 4, 2017
    Posts:
    10
    Hi, I use Advanced Input Field for 1 year. It is a good tool but today, I have a big problem: the code works on IOS and MacOS but, on Android, it generates the following error as soon as I click on an advancedInputField field (and besides without showing neither cursor nor keyboard)

    I use your last version 1.9.2 and he Unity version 2019.3.0b8 (the only one able to compile my project under the new MacOs Catalina !)

    Here is the error.. could you help me please ? Thanks

    2019-10-27 19:07:18.066 12578-12616/com.AirTrophy.AirTrophy10 E/Unity: NullReferenceException: Object reference not set to an instance of an object.
    at AdvancedInputFieldPlugin.AndroidKeyboard.EnableUpdates () [0x00000] in <00000000000000000000000000000000>:0
    at AdvancedInputFieldPlugin.NativeKeyboard.UpdateActiveState () [0x00000] in <00000000000000000000000000000000>:0
    at AdvancedInputFieldPlugin.AdvancedInputField.CheckClick (UnityEngine.EventSystems.PointerEventData eventData) [0x00000] in <00000000000000000000000000000000>:0
    at AdvancedInputFieldPlugin.AdvancedInputField.OnPointerUp (UnityEngine.EventSystems.PointerEventData eventData) [0x00000] in <00000000000000000000000000000000>:0
    at UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1].Invoke (T1 handler, UnityEngine.EventSystems.BaseEventData eventData) [0x00000] in <00000000000000000000000000000000>:0
    at UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] fu
     
  27. DORNE

    DORNE

    Joined:
    Jul 4, 2017
    Posts:
    10
    I found the problem: when I switch off the publishing setting "Custom gradle Template", it works well !
     
  28. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Yes, the plugin hides that topbar by default on iOS. It also provides an event when the keyboard height changes so you can place Unity UI above the keyboard when it appears (and hide Unity UI when it dissapears).
     
  29. unity_sergigil

    unity_sergigil

    Joined:
    Nov 11, 2019
    Posts:
    15
    Hi! I have a problem with Ios 13 and this plugin.. the thing is that I'm disabling the Emojis Allowed and this works in all the ios and android devices that I have tested, but with Ios 13, I'm permitted to add emojis (that are shown as squares in my input text)... Are you aware of this? is easy to try to fix this problem?

    thanks
     
  30. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Check your PM
     
  31. takoy

    takoy

    Joined:
    Jul 2, 2015
    Posts:
    20
    Same issue here..
     
  32. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    I'll post the fix here that I already send to original reporter of the issue:
    Replace the file NativeKeyboard.a in Assets/Plugins/iOS with the one in attached zip.
     

    Attached Files:

    takoy likes this.
  33. unity_sergigil

    unity_sergigil

    Joined:
    Nov 11, 2019
    Posts:
    15
    I'm testing the modes scene because I want to implement something similar to the vertical resize but with an animation... the thing is that I'm experimenting some strange behaviors with the keyboard appearing and the reposition for the vertical input box...

    In a Samsung s8 with Android 9 installed seems to work fine but I have noticed that every time you press the Vertical Input Box this is moved to the most bottom part of the screen and then repositioned in the correct position. So I have a question in here... can we know the original keyboard size before opening it? so we can move the vertical Input Box there and then open the keyboard?

    video: https://drive.google.com/open?id=1bTpXHb6LwnuOiJSsDkgi3bdq00GFe7Ra

    In an old Motorola Nexus 6 with Android 5 I have very strange behaviors like not positioning the vertical Input Box in the correct positions (over keyboard) and I could manage to get the keyboard open and the input box hidden behind

    video: https://drive.google.com/open?id=1olsAdOHPtN90X-dgV-PeMy3MqFpjEvGq

    What do you think about?

    Thanks in advance

    Sergi
     
  34. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    For the first issue: The Android API unfortunately doesn't provide a way to get the keyboard before actually showing it. The way the plugin currently detects keyboard height changes is by observing native layout changes (since the Android API doesn't really provide a nice way to get the height).
    You could try to use a default value when OnBeginEdit event get's called and adjust it when you get the actual keyboard height from the OnKeyboardHeightChanged event.

    For the second issue: I don't really know why that device would behave differently. Also, I can't view the video. It's asking for permissions.
     
  35. unity_sergigil

    unity_sergigil

    Joined:
    Nov 11, 2019
    Posts:
    15
  36. qofi

    qofi

    Joined:
    Mar 6, 2017
    Posts:
    3
    When I use SelectionCursor and SCROLL_TEXT, this error appears.
    the marker retains its position after scrolling.
    Can I hide the cursor (as in RectMask)?
    If so, how?
     

    Attached Files:

    • 1.PNG
      1.PNG
      File size:
      31 KB
      Views:
      485
    • 2.PNG
      2.PNG
      File size:
      30.2 KB
      Views:
      502
  37. MindTipGames

    MindTipGames

    Joined:
    Oct 1, 2016
    Posts:
    10
    Thank you for making this asset! It definitely fills a big gap in Unity's base tools of basic UI in my opinion. I mean, it is a simple scrolling text box... I accepted a project to make a basic typing text app that stores entered information in a box for retrieval later thinking my skills as a Unity developer would have this covered. Boy was I wrong! Unity fails majorly here and I've had to think about going into base Android studio/Xcode to figure this out. I almost gave the client back their money but did just ... one... more ... search for a solution in the asset store. I didn't find one using the basic Unity Asset Store search. But I DID find your asset using Google search. (lesson here... use Google to search for your assets)

    Okay, now the problem. I just bought your asset on 11/27/2019 and have been toying with it. It almost does exactly what I need. My goal is to have a scrolling Title field and Post field that I can store in files and bring back with a toolbar on the top to control program workflow (save, undo). If you see Android's basic Memo app, that's the goal! Your Multiline example scene is almost there. I used this example as the base of my needed post scene. I modded the "Story" gameobject to Select/Copy/Paste text and still keep the base "Drag the Text" functionality when you drag across the text field. But, I am seeing the same "floating select cursors" that @qofi is seeing in the previous post (what timing!) See File # 2 for the behavior. See File #4 for the Mobile settings that I chose for this effect. Maybe there is a better way you can recommend to get your asset to behave exactly like the Android basic Memo App? Or fixing the Floating Select Cursors problem would be okay, too. The screens I am sharing are from the Unity Editor, but I am seeing the same behavior from my Android device (Galaxy S5 - Marshmellow OS). Please update here with a recommendation or advise what the fix is for the floating cursors. I appreciate your help on this.

    Best,
    Ron
     

    Attached Files:

  38. takoy

    takoy

    Joined:
    Jul 2, 2015
    Posts:
    20
    First of all I have to say this asset has saved me a lot of time and I highly recommend it!

    I have an issue which I haven’t manage to figure out after switching to this asset from TextMeshPro.

    Previously when I used the TextMeshPro while focused on an InputField- when I received an SMS with a verification code I could automatically copy it to the inputfield using 1 click (at least on the iPhone I used).
    Now after switching to this asset I can’t do that.. am I doing something wrong here? Do I need to change something to enable that?

    thanks
     
  39. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    I can reproduce the issue and am working on a fix (hopefully I can get it stable this weekend).
    Basically I need to rewrite the mobile cursors to change the render layer when needed, sometimes they need to be in the back layer (scrollrect of the inputfield) and sometimes in the front layer (when dragging them or they are partly out of bounds on the left or right side of the inputfield).
    I'll also keep in mind that the ActionBar should always be rendered in front of the Mobile Cursors.
     
  40. qofi

    qofi

    Joined:
    Mar 6, 2017
    Posts:
    3
    While working, I discovered another problem.
    If the phone screen resolution does not match that indicated on the canvas, the keyboard height in "NativeKeyboardManager.AddKeyboardHeightChangedListener" is not calculated correctly.
    For example, when the resolution of the canvas is 1080 * 1920, and the phone is 1080 * 2340, an additional indent appears on the keyboard.

    In the screenshots, I raise the “InputField” to the height of the keyboard.

    Could you watch this moment?

    Thanks in advance
     

    Attached Files:

    • 1.PNG
      1.PNG
      File size:
      24.8 KB
      Views:
      496
    • 2.PNG
      2.PNG
      File size:
      22.3 KB
      Views:
      488
  41. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    The height that event gives back is in screen pixels, because it doesn't know your Canvas settings. So, you'll have to divide it by the Canvas.scaleFactor of the Canvas you are using.
    Also, check the Modes samples scene and the ModesControl script as a reference.
     
  42. qofi

    qofi

    Joined:
    Mar 6, 2017
    Posts:
    3
    Thanks! It helps me!
     
  43. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Fix is included in latest version (1.9.4)
     
  44. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Sorry for the late response. This isn't something I usually test, but just to make it clear. With the TMP Inputfield it would automatically paste the copied value from the sms when returning to the app? If possible, a video demonstrating this behaviour would be helpful.
     
  45. Becreatives

    Becreatives

    Joined:
    Apr 17, 2018
    Posts:
    17
    Hi, i've a problem. When i ran my app on Android tablet and I press Go/Send/Search button the keyboard isn't dismissed. This happend randomly or if i didn't setted up a Next Input Field.

    I want to dismiss the keyboard but it didn't happend What can i do? Seems it do the KeyboardScroller.ScrollBack() logic but don't hide really the keyboard.

    It's super urgent to me to fix this.

    I'm using Unity 2019.2.8 and MacOS Catalina
     
  46. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Could you send me a screenshot of the settings you use on that inputfield?
    Are you using the default Android OS keyboard on that tablet or a third-party one?
    It's weird that you say that the scroll back logic is working or does the keyboard hide and reappear immediately?
    Also, are you using latest version of the plugin?
     
  47. Becreatives

    Becreatives

    Joined:
    Apr 17, 2018
    Posts:
    17
    I'm using the last version of your plugin. Android tablet use the Swiftkey Keyboard by default, but i've tried to install and use the Gboard and it's the same problem.
    I console logged the Scroll Back event and the Hide Keyboard event. If i press the first time the return key i receive both the events, but the keyboard doesn't disappear.
    If i click again on the Input Field keyboard hide and reappear immediately and works fine, but the first time it's always bugged.
     

    Attached Files:

  48. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    I could reproduce it using your settings and could find the source of the problem (race conditions between 2 native events).
    I could fix it by swapping 2 lines of code in the DelayedDeselect() method in AdvancedInputField.cs. (Sending native keyboard hide event before the deselect event).
    Change that method to the following:
    Code (CSharp):
    1. internal IEnumerator DelayedDeselect()
    2. {
    3.             yield return null;
    4.             if(this == null) { yield break; }
    5.  
    6.             if(!initialized)
    7.             {
    8.                 yield break;
    9.             }
    10.  
    11.             if(IsCanvasFrontRendererSelected() || IsInputFieldButtonSelected() || IsInputFieldChildSelected()) //Invalid deselect
    12.             {
    13.                 Reselect();
    14.             }
    15.             else if(ShouldBlockDeselect)
    16.             {
    17.                 if(OnEndEdit != null)
    18.                 {
    19.                     onEndEdit.Invoke(text, endEditReason);
    20.                 }
    21.                 Reselect();
    22.             }
    23.             else //Valid deselect
    24.             {
    25.                 EndEditMode();
    26.                 DisableSelection();
    27.             }
    28.  
    29.             endEditReason = EndEditReason.USER_DESELECT; //Reset to default reason (deselection)
    30.         }
     
  49. Becreatives

    Becreatives

    Joined:
    Apr 17, 2018
    Posts:
    17
    Thank you, now seems to work fine.
     
  50. alexm_scp

    alexm_scp

    Joined:
    Nov 5, 2019
    Posts:
    24
    Hi!

    I love this plugin, and it works so great, but I need to show the Mobile Input (the editable text field above the mobile virtual keyboard) I don't find the way to do it. I notice that TMP_Input Field has a property to hide/show this Mobile Input, how can I show it using the plugin?

    Thanks in advance