Search Unity

Advanced Input Field 2

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

  1. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    133
    Hmm...Can't really explain why it feels laggy for you.
    It might be slightly slower than a native inputfield, because Unity & iOS UI components run on different threads, but that should not really be that noticeable.
    I've justed the plugin in a clean Unity project (Unity 2019.4.19) with the same sample scene on a iPhoneXS. Just used to default build settings and ran it from XCode. And I don't notice any lag. I see that characters getting inserted and cursor moving immediately when typing. Even when typing characters rapidly.

    I didn't really have had other users reporting lag on the newer iOS devices.
    Maybe try it in a clean Unity project to rule out that other plugins in your project might be conflicting with it.
     
  2. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    133
    I've just tried this in a clean Unity project using the same versions of Unity Editor & TextMeshPro and it's working for me on a iPhoneXS.

    upload_2021-3-10_20-24-32.png

    Maybe try to regenerate emoji asset file and store it using a different filename. Sometimes that fixes corrupt emoji files. Not sure why it happens sometimes though, might be because it's a subclass of a TextMeshPro class.
    For me it shows this inspector currently, (3300 emojis)
    upload_2021-3-10_20-29-48.png
     
  3. jos_valentin

    jos_valentin

    Joined:
    Aug 4, 2020
    Posts:
    23
    Hi, i need help, when i tap the input field, the android action bar(the bar in the top in android mobile) changes, i have enabled it from my own code, but when i tap the field, it turns black and changes my game screen a little, making all my UI stuff going a little down form its original place. I guess this is part of the plugin code, can you help me to disable that behaviour?
     
  4. unity_sergigil

    unity_sergigil

    Joined:
    Nov 11, 2019
    Posts:
    15
    I tried the chat example from the plugin and is working to me... so I changed how we were dealing with emojis in our game...

    Initial implementation
    In our game we had to download the emojis + sprite asset using assetbundles so I did a trick to have a default sprite asset with a simple image and after downloading the needed assetbundle, assign to the default sprite asset fallback and that was causing the problems that I posted before with the skinned emojis. It seems that in the text we have currently a unicode embeeded, so I don't know why is not using <sprite> rich text tag

    Second implementation
    Just to test I have assigned the sprite asset in the TMP default sprite asset settings and then as in your chat example all works perfectly (seems that then we use <sprite> rich text tag)

    Third implementation
    I have removed the TMP default sprite asset settings and I'm downloading the needed assetbundle, and I have a component that injects in the needed TMP the downloaded sprite asset and enabled rich text for the TMP and this it seems to have the same effect as the initial implementation, generating double emojis and embedding a unicode in the text instead of using <sprite>

    I don't know if this is the way to go or @fennecx_support recommend another way to do this?

    One more question that I have is if I need to enable rich text in all the TMP that needs to show emojis because it seems that TMP is using a <sprite name "XXXX"> to actually deal with the emoji? I have tried and if I disable rich text the emoji is not drawn anymore
     
    Last edited: Mar 11, 2021
  5. jos_valentin

    jos_valentin

    Joined:
    Aug 4, 2020
    Posts:
    23
    Can someone help me with this? please
     
  6. tuxxmuxx

    tuxxmuxx

    Joined:
    Feb 2, 2013
    Posts:
    4
    Hi, can you add more autofill types? i need some for registration, name, lastname, address, etc...
     
  7. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    133
    Ah, didn't know you were trying to change the emoji asset on runtime.
    In that case you might need to reconfigure the EmojiEngine. Haven't tried this, but I except you first need to update TextMeshPro settings to use your emoji asset file and then call "NativeKeyboardManager.EmojiEngine.ConfigureEmojis(emojiAsset);" with your emoji asset as the parameter.

    Regarding the "RichTextEditing" property. It shouldn't really matter if it's enabled or not when "EmojisAllowed" is enabled. Internally it checks if 1 of those 2 properties is enabled to activate rich text. In my sample scene "Chat" I see in the inspector that the "RichTextEditing" property isn't even enabled.
     
  8. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    133
    The plugin does set some of the fullscreen mode flags for the navigation bar when the keyboard appears, because without them certain devices, such as Xiaomi devices were displaying flashy glitches.
    It should restore the fullscreen mode flags when the keyboard dismisses.

    Could you send the code that you use to enable the Android status bar? So I can check if I can reproduce and fix it.
     
  9. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    133
    Could you create an issue (feature request) on the issuetracker:
    https://github.com/support-fennecx/advancedinputfield2/issues
    and mention which autofill types you need? So I can check if they are available on Android & iOS.
     
  10. bramble-operations

    bramble-operations

    Joined:
    Aug 27, 2019
    Posts:
    9
    Hi I just upgraded from version 1 to version 2. In version 2 the character limit does not seem to be working. the line limit is working fine but the character limit doesn't work, even when I create a new Advanced input field by Tools > Advanced Input Field > Create > InputField with TextMeshPro Text. please help! thanks :)
     
  11. bramble-operations

    bramble-operations

    Joined:
    Aug 27, 2019
    Posts:
    9
  12. jos_valentin

    jos_valentin

    Joined:
    Aug 4, 2020
    Posts:
    23
    Hi, thanks for the response, there is no a way i can disable that behaviour by myself?,here is the code i use to show the status bar:
    Code (CSharp):
    1.  
    2.     void Start()
    3.     {
    4.  
    5.         SetWindowedMobileScreen();
    6.     }
    7.  
    8.     public void SetWindowedMobileScreen()
    9.     {
    10. #if UNITY_ANDROID
    11.         ShowStatusBarAndroid();
    12. #endif
    13.         Screen.fullScreen = false; // ------
    14.     }
    15.  
    16. public static void ShowStatusBarAndroid()
    17.     {
    18. #if !UNITY_EDITOR && UNITY_ANDROID
    19.         setStatusBarValue(2048); // WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN
    20. #endif
    21.     }
    22.    
    23. private static void setStatusBarValue(int value)
    24.     {
    25.         newStatusBarValue = value;
    26.         using (var unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
    27.         {
    28.             using (var activity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity"))
    29.             {
    30.                 activity.Call("runOnUiThread", new AndroidJavaRunnable(setStatusBarValueInThread));
    31.             }
    32.         }
    33.     }  
    34.  
    35. private static void setStatusBarValueInThread()
    36.     {
    37.         using (var unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
    38.         {
    39.             using (var activity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity"))
    40.             {
    41.                 using (var window = activity.Call<AndroidJavaObject>("getWindow"))
    42.                 {
    43.                     window.Call("setFlags", newStatusBarValue, newStatusBarValue);
    44.                 }
    45.             }
    46.         }
    47.     }
     
  13. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    133
    I've send you a PM.
     
  14. jiraphatK

    jiraphatK

    Joined:
    Sep 29, 2018
    Posts:
    300
    Is there upgrading guide from V1? We're considering upgrading to v2 for the emoji support.
     
  15. Seb_L

    Seb_L

    Joined:
    Feb 17, 2021
    Posts:
    16
    Hello,
    I just installed this Asset. I simply add a Field and transfer it to my iphone 12. Wenn I enter in the Field, the application crash ! Can you help me please.
     
  16. gouasmimedlotfi

    gouasmimedlotfi

    Joined:
    Oct 13, 2019
    Posts:
    9
    Hello again thanks for the reply

    it seems that the problem is with the live decoration filter i'm using in order to write in arabic , it was working fine in the first version, is there any workaround ?
    Code (CSharp):
    1. using AdvancedInputFieldPlugin;
    2. using System.Text;
    3.  
    4. public class LiveProcessor_Arabic : LiveDecorationFilter
    5. {
    6.     /// <summary>The StringBuilder</summary>
    7.     private StringBuilder stringBuilder;
    8.  
    9.     /// <summary>The StringBuilder</summary>
    10.     public StringBuilder StringBuilder
    11.     {
    12.         get
    13.         {
    14.             if (stringBuilder == null)
    15.             {
    16.                 stringBuilder = new StringBuilder();
    17.             }
    18.  
    19.             return stringBuilder;
    20.         }
    21.     }
    22.  
    23.    
    24. public override string ProcessText(string text, int caretPosition)
    25. {
    26.    StringBuilder.Length = 0;
    27.    return Arabic.BidirectionalSupport.Fix(text);
    28. }
    29.    
    30.     public override int DetermineProcessedCaret(string text, int caretPosition, string processedText)
    31.     {
    32.         return caretPosition;
    33.     }
    34.    
    35.     public override int DetermineCaret(string text, string processedText, int processedCaretPosition)
    36.     {
    37.         return processedCaretPosition;
    38.     }
    39.  
    40.  
    41. }
     
  17. Seb_L

    Seb_L

    Joined:
    Feb 17, 2021
    Posts:
    16
    It crash also on the Ipad.
    I test it with xcode and the simulator.

    I have the error : Symobol not found : __nativeKeyboard_initialize Expected in: flat namespace.
     
  18. Seb_L

    Seb_L

    Joined:
    Feb 17, 2021
    Posts:
    16
    Hello,

    Another question.
    With the Unity Input Field, i create a InputExtention class to be able to add a listener on OnSelect.
    how can I do this, with the Advanced Input Field ?

    My code :
    Code (CSharp):
    1. public static class InputExtention
    2. {
    3.     public static void AddEventSelectListener<T>(this TMP_InputField p_input, T param1, Action<T> OnSelect)
    4.     {
    5.         p_input.onSelect.AddListener(delegate (string s)
    6.         {
    7.             OnSelect(param1);
    8.         });
    9.     }
    10. }
    And call with :
    Code (CSharp):
    1. Input.AddEventSelectListener(param, InputSelect);
     
  19. gouasmimedlotfi

    gouasmimedlotfi

    Joined:
    Oct 13, 2019
    Posts:
    9
    There are already events you can use for what you want : OnSelectionChanged and OnBeginEdit
     
  20. unity_albertosalieto

    unity_albertosalieto

    Joined:
    Feb 4, 2021
    Posts:
    2
  21. unity_sergigil

    unity_sergigil

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

    we are trying to replicate a bit whatsapp behaviour in my android when typing... so we want:
    1. write multiple lines and then start scrolling while writing
    2. when dragging over the input we can scroll up or down
    3. when pressing for some time and you drag you start selecting written text in input (we want to be able to select down and up direction)
    4. when releasing the finger and after selecting some text the action bar is shown
    At the moment I can achieve the first point, but for the others I cannot... perhaps there are some parameters that I can tweak?

    Right now the behaviour that I have is that when dragging over a written part the selection starts, and the action bar is shown automatically... and I can select down and the input scrolls but I cannot select and scroll up

    Thanks!

    Sergi
     
  22. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    133
    Sorry for the late reply.
    You might have already found it, but just in case:
    In the documentation file of version 2 of the plugin there is a section called "Upgrade Notes".

    (Link to documentation is also available in the first post of this thread)
     
  23. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    133
    Sorry for the late reply.
    If I understand correctly the issue occurs when using your LiveDecorationFilter on a multiline inputfield.
    Does this happen with any LiveDecorationFilter on that inputfield or only the specific one you are using for Arabic?
     
  24. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    133
    Version 2.0.6 is pending release on the AssetStore:
    • Bugfix: Fixed text not scrolling when dragging start touch cursor when using RichText or emoji support
    • Bugfix: Small fix to get latest ShouldBlockDeselect value again after OnEndEdit event
    • Bugfix: Fixed issue that putting app in background and back to foreground was autoselecting last inputfield when it was not focused when putting app in background
    • Bugfix: When using the .BlockShouldDeselect property the keyboard type changes when tapping another inputfield
    • Improvement: Improved autofill support for iOS & Android
    • Feature: Implemented extra autofill types for iOS & Android
    • Feature: Added Save Credentials method for iOS & Android (using autofill fields)
    • Improvement: Improved algorithm to optimize ActionBar item and text sizes (preferred font size, text padding,… can be changed on the ActionBar prefabs)
     
  25. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    133
    1. Set "Mode" property to "VERTICAL_RESIZE_FIT_TEXT" and set "ResizeMaxHeight" property
    2. Set "DragMode" property to "MOVE_TEXT"
    3 & 4. Currently not exactly possible with current properties, will need to implement something for this. You can select text though by double tapping a word and by setting the "TouchSelectionCursorsEnabled" property to true, so you have selection handles you can drag.
     
  26. gouasmimedlotfi

    gouasmimedlotfi

    Joined:
    Oct 13, 2019
    Posts:
    9
    No it actually happens for every input field i add the livedecoration to, it was only hapening to the multiline one because i didn't need to add it to others.
    Right now i downgraded to the v1 and the liveprocess works as intended (well at least on mobile).

    I really want to use that v2, thought about removing arabic, but can't afford it with my target audiance, and i guess v2 conflicts with the arabic plugin ( Arabic Support for Unity | GUI Tools | Unity Asset Store )

    if it's not possible it's okay anyway v1 is still working without any problem.
     
  27. swifter14

    swifter14

    Joined:
    Mar 2, 2017
    Posts:
    165
    How do I move the input field window to be on top of the Android keyboard? Right now I can't see the text that I type because the android keyboard hides the input field....
     
    Last edited: Mar 29, 2021
  28. gouasmimedlotfi

    gouasmimedlotfi

    Joined:
    Oct 13, 2019
    Posts:
    9
    See the documentation pdf file about keyboard scrolling
    basically add a scroller , keyboard scroller script to it, and put anchors and a child object of the content gameobject of that scroller exactly as they are in the tutorial, also see the form example
     
  29. Seb_L

    Seb_L

    Joined:
    Feb 17, 2021
    Posts:
    16
    Hello,

    How can i select the content of the InputField, wenn i click in the InputField, like ActivateInputField in the Standard InputField. I try ManuelSelect(), but it doesn't work. Thanks.
     
  30. swifter14

    swifter14

    Joined:
    Mar 2, 2017
    Posts:
    165
    Is there a way to lock the (default) keyboard? When tapping on the screen the keyboard goes away.... For example, I have a chat app when clicking SEND the keyboard disappears. I don't use your keyboard but the default mobile keyboard
     
  31. ApenasVB

    ApenasVB

    Joined:
    Nov 26, 2014
    Posts:
    3
    Hi @fennecx_support, is the asian languages support under development? Is there anything that we can do to help adding support to asian characters?
     
  32. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    133
    I've added the issue to issue tracker on GitHub, so I won't forget to check it out.
    https://github.com/support-fennecx/advancedinputfield2/issues/26
     
    gouasmimedlotfi likes this.
  33. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    133
    Normally the ManualSelect() should focus the inputfield.
    Are you called this in Awake()? Maybe the inputfield is not initialized yet at that point.
     
  34. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    133
    Using the official Unity TouchScreenKeyboard class I don't know if that's possible.

    When using an AdvancedInputField you can block this behaviour. See the "How to keep the AdvancedInputField focused when clicking on other UI Elements?" section (in the FAQ) in the Documentation file for more information.
     
  35. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    133
    For Android & iOS I could input & render Japanese characters, see the issue tracker:
    https://github.com/support-fennecx/advancedinputfield2/issues/7

    It would help if someone who can read Japanese could verify if this works as expected.
     
    ApenasVB likes this.
  36. swifter14

    swifter14

    Joined:
    Mar 2, 2017
    Posts:
    165
    In android, when pausing the app (getting a call/locking the phone) while the mobile keyboard is open, I get 2 bugs when returning back to the app,

    1. Clicking on the input field doesn't open the keyboard anymore
    2. Sometimes the keyboard is still open, but I can't close it (even when clicking on other UI elements, or even when clicking on Done). The only way to close it is to click the Down arrow

    -I probably should add something to OnApplicationPause ?
    -What command should I add for InvokeEndEdit to force it to close the keyboard like the down arrow does?
     
    Last edited: Mar 31, 2021
  37. Seb_L

    Seb_L

    Joined:
    Feb 17, 2021
    Posts:
    16
    Hello,

    My Problem ist not the Focus. I want that the Content of the InputField is not automatically selected.
    For exemple. You have 25 in an Input Field. If you want 88, you must first delete 25, and than enter 88. In the Standard Input Field, If you click in the Field, 25 was selected et you don't need first delete first.
    Is this Option possible ?
     
  38. bryan_l1

    bryan_l1

    Joined:
    Apr 6, 2017
    Posts:
    12
    Some initial testing shows it appears to work fine on both iOS and Android displaying and submitting Simplified Chinese, Traditional Chinese and Japanese using the Noto CJK font following this tutorial. (Korean glyphs show up fine but I can't read Korean so can't verify)

    Haven't tested with emojis but if emojis are not imported, leave the "Emojis Allowed" option in the Advanced Input Field component unchecked or some of the characters will show up as alphabet. Hope this helps!
     
    ApenasVB likes this.
  39. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    133
    Which version of the plugin are you using? I did fix something recently related to application pause/resume on Android.

    Normally you can force it to close using: NativeKeyboardManager.HideKeyboard();
    If no inputfield is focused at this point you might also need to call: NativeKeyboardManager.EnableUpdates(), so the native Android thread will process it.
     
  40. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    133
    Ah, you just want to select all text automatically when focusing the inputfield.
    I've modified the code a bit to add the "SELECT_ALL" option for the "CaretOnBeginEdit" property.

    See modified files below:
    So you can set the "CaretOnBeginEdit" property to "SELECT_ALL" to get the behaviour you want.
     

    Attached Files:

  41. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    133
    OK, thank you for verifying. I'll update the documentation with the instructions.
     
    ApenasVB likes this.
  42. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    133
    Version 2.0.7 is pending release on the AssetStore:
    • Improvement: Added fallback if ActionBar text & size optimalization fails
    • Bugfix: Fixed scalefactor issue of get preferred width/height methods (used for ActionBar
    text & size optimalization)
    • Feature: Added SELECT_ALL option for CaretOnBeginEdit property
    • Bugfix: Fixed issue when dragging text selection when using a LiveProcessingFilter
    • Bugfix: Fixed race condition between Unity and native thread when rapidly typing or
    deleting characters
     
  43. swifter14

    swifter14

    Joined:
    Mar 2, 2017
    Posts:
    165
    On Android, version 2.0.6 , the blue Done button doesn't respond when the app gets focus again (when clicking power button off, and coming back to the app from lock screen), the done button doesn't close the keyboard, only the arrow down button CAN HIDE it. NativeKeyboardManager.HideKeyboard() - DOESN'T HIDE IT AS WELL

    I also tried to use
    void OnApplicationPause(bool boo)
    { NativeKeyboardManager.EnableHardwareKeyboardUpdates();}
    but it didn't do anything. And I didn't find the NativeKeyboardManager.EnableUpdates() function that you reccomended
     
    Last edited: Apr 6, 2021
  44. Yi-GPS

    Yi-GPS

    Joined:
    Jan 21, 2020
    Posts:
    5
    Hello. We are having some issues with the keyboard on Android. Basically when you partially typed out a word and select one of the auto complete options by Gboard, the word does not get replaced. It's especially obvious when there's typo in the partially typed out word. I have submitting a bug report here https://github.com/support-fennecx/advancedinputfield2/issues/27 for more details.

    Meanwhile if there is workaround we can apply that will be greats.
    I tracked it to

    internal void SetText(string text)

    in InputFieldEngine.cs and confirmed
    text
    being passed it contains the correct value when user presses the suggested word, while
    this.text 
    contains the incorrect value.
    I've tried to directly call
    InputField.TextRenderer.Text = this.text;

    after
    InputField.UpdateTextProperty(this.text);

    but that doesn't seem to help. If there is suggestion on what we can do that will be greatly appreciated. Thank you!
     
  45. Synthol67

    Synthol67

    Joined:
    Dec 17, 2020
    Posts:
    2
    Hello, I see with the release 2.0.7 there is a new feature Added SELECT_ALL option for CaretOnBeginEdit property. But I haven't got it in the poplist. I have imported the new Version 2.0.7. (from Package Manager). What can I do ?
    The strangest thing is when I go to the About Windows of Advanced Input Field, I have the Version 2.0.5 and not the 2.0.7
     
    Last edited: Apr 7, 2021
  46. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    133
    Does this happen on all your Android devices? Or only a specific device?
    I tried clicking the power button off and on, but on my test devices the confirm button isn't stuck then.

    Regarding that missing method. Though I've also added a wrapper method for that method too, but you also call it directly using:
    NativeKeyboardManager.Keyboard.EnableUpdates();
     
  47. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    133
    Seems like that prefab had the "EmojisAllowed" property enabled by default, should be disabled by default (since it's a more advanced feature). I've disabled the property on the prefab and then it works correctly. So that is the quick fix.

    Also, renamed the title of the issue of you created on the issue tracker, so I can check this issue (with emoji support enabled) more in depth later.
     
  48. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    133
    Yes, that's strange.
    Maybe try uninstalling and installing plugin again?
    Might be something stuck in the Unity Cache.
     
  49. swifter14

    swifter14

    Joined:
    Mar 2, 2017
    Posts:
    165
    It happens in all of my android devices do you want me to send you a video?
    After I press power on it seems like fter EndEditReason.KEYBOARD_DONE worked, but the keyboard is still on the screen and stuck, unless you press hide keyboard
    NativeKeyboardManager.Keyboard.EnableUpdates() doesn't help.
     
  50. fennecx_support

    fennecx_support

    Joined:
    Dec 28, 2020
    Posts:
    133
    I've had some more time to test it an other devices and found one that has the same issue. Don't have a fix for it yet, but I've added it to the issuetracker, so it won't forget to look into it: https://github.com/support-fennecx/advancedinputfield2/issues/30