Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Advanced Input Field

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

  1. MrSaoish

    MrSaoish

    Joined:
    Oct 1, 2016
    Posts:
    22
    Hi,

    I tried to use create AdvancedInputField_TextMeshPro_Text in my scene but it can't load TMProTextRenderer. I am doing it on a fresh created 2D project for testing.

    Unity version: 2018.2.18f1
    AdvancedInputField version: 1.7.1
     

    Attached Files:

  2. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    The instructions to enable TextMeshPro are also in the ReadMe, but I'll post them here too.

    To use TextMeshPro Text Renderers in combination with this plugin use the following steps:
    1. Install the TextMeshPro package from the PackageManager window in Unity:
    (Window => Package Manager)
    2. Find the TextMeshPro package in the list and install it
    3. Open the Player Settings in Unity
    (Edit => Project Settings => Player)
    4. In “Scripting Define Symbols” add the following value: ADVANCEDINPUTFIELD_TEXTMESHPRO
    5. Recompile (normally Unity does this automatically)
    6*. If it still doesn't work, it probably means that the Unity Package manager didn't add the reference to TextMeshPro properly to Visual Studio (this unfortunately sometimes happen). You can check if it got added correctly by trying to access a class from TextMeshPro in code. Removing and reinstalling TextMeshPro from the PackageManager usually works.
    7*. If the TMProTextRenderer still doesn't load, try the option "reimport all"
     
  3. BjoUnity3d

    BjoUnity3d

    Joined:
    Jul 24, 2012
    Posts:
    59
    Hi,
    I'm getting this error and no native keyboard (Android) only when I'm in one particular scene. The Advanced input field works normally in other game scenes in the same app. I tried reinserting the input prefab but the same error happens. Any ideas?


    AndroidJavaException: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.os.Handler.post(java.lang.Runnable)' on a null object reference

    12-20 01:35:31.993 5719 5748 E Unity : java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.os.Handler.post(java.lang.Runnable)' on a null object reference

    12-20 01:35:31.993 5719 5748 E Unity : at com.jeroenvanpienbroek.nativekeyboard.NativeKeyboard.enableUpdates(NativeKeyboard.java:662)

    12-20 01:35:31.993 5719 5748 E Unity : at com.unity3d.player.UnityPlayer.nativeRender(Native Method)

    12-20 01:35:31.993 5719 5748 E Unity : at com.unity3d.player.UnityPlayer.c(Unknown Source:0)

    12-20 01:35:31.993 5719 5748 E Unity : at com.unity3d.player.UnityPlayer$e$2.queueIdle(Unknown Source:72)

    12-20 01:35:31.993 5719 5748 E Unity : at android.os.MessageQueue.next(MessageQueue.java:395)

    12-20 01:35:31.993 5719 5748 E Unity : at android.os.Looper.loop(Looper.java:160)

    12-20 01:35:31.993 5719 5748 E Unity : at com.unity3d.player.UnityPlayer$e.run(Unknown Source:32)

    12-20 01:35:31.993 5719 5748 E Unity : at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <filename unknown>:0

    12-20 01:35:31.993 5719 5748 E Unity : at UnityEngine.AndroidJNISafe.CallStaticVoidMethod (IntPtr clazz, IntPtr methodID, UnityEngine.jvalue[] args) [0x00000] in <filename unknown>:0

    12-20 01:35:31.993 5719 5748 E Unity : at UnityEngine.AndroidJavaObject.
     
  4. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Maybe the native Android binding doesn't get cleaned and recreated properly when loading a new scene (not additive).
    Could you try adding the line "DontDestroyOnLoad(gameObject);" in Scripts/NativeKeyboard/NativeKeyboardManager.cs in the property "Instance"?:
    Code (CSharp):
    1. private static NativeKeyboardManager Instance
    2. {
    3.      get
    4.     {
    5.         if(instance == null)
    6.         {
    7.             instance = GameObject.FindObjectOfType<NativeKeyboardManager>();
    8.             if(instance == null)
    9.             {
    10.                 GameObject gameObject = new GameObject("NativeKeyboardManager");
    11.                 DontDestroyOnLoad(gameObject);
    12.                 instance = gameObject.AddComponent<NativeKeyboardManager>();
    13.             }
    14.         }
    15.  
    16.         return instance;
    17.     }
    18. }
     
  5. BjoUnity3d

    BjoUnity3d

    Joined:
    Jul 24, 2012
    Posts:
    59
    Thanks for the fast response. I will try that. It sounds like that might be right. Here is what triggered the error:

    1) AIF exists in scene #1 in a Doozy UI Element with DontDestroyOnLoad at the top level canvas
    2) In scene #2 the UI Element containing AIF (from scene #1) is shown and works fine (however scene #2 contains other AIF elements of its own)
    3) In scene #3 the same UI Element containing AIF (from scene #1) is shown and doesn't work (scene #3 doesn't contain any other AIF elements of its own)

    I got around it by adding an AIF input to an off-screen canvas in scene #3 so it has its own. Then the AIF from scene #1 works fine when it is shown in scene #3.

    Thanks!
     
  6. kickassqc

    kickassqc

    Joined:
    Jul 7, 2015
    Posts:
    4
    Good morning, I'm using your plugin with TextMeshPro, but it's not working correctly everytime I try to modify the text in editor or realtime I got those errors :

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. AdvancedInputFieldPlugin.AdvancedInputField.InitializeInputField () (at Assets/Plugins/Advanced Input Field/Scripts/InputField/AdvancedInputField.cs:1481)
    3. AdvancedInputFieldPlugin.AdvancedInputField.Awake () (at Assets/Plugins/Advanced Input Field/Scripts/InputField/AdvancedInputField.cs:1032)
     
  7. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    From that error log, it looks like it can't find the TMProTextRenderer, which probably means that TextMeshPro isn't properly configured. (You can see if this is the issue by checking if the TextRenderer component can be loaded on the gameobject "TextArea/Content/Text" of an AdvancedInputField gameobject).

    Did you follow the instructions in the ReadMe? I'll post them here too:

    To use TextMeshPro Text Renderers in combination with this plugin use the following steps:
    1. Install the TextMeshPro package from the PackageManager window in Unity:
    (Window => Package Manager)
    2. Find the TextMeshPro package in the list and install it
    3. Open the Player Settings in Unity
    (Edit => Project Settings => Player)
    4. In “Scripting Define Symbols” add the following value: ADVANCEDINPUTFIELD_TEXTMESHPRO
    5. Recompile (normally Unity does this automatically)
    6*. If it still doesn't work, it probably means that the Unity Package manager didn't add the reference to TextMeshPro properly to Visual Studio (this unfortunately sometimes happen). You can check if it got added correctly by trying to access a class from TextMeshPro in code. Removing and reinstalling TextMeshPro from the PackageManager usually works.
    7*. If the TMProTextRenderer still doesn't load, try the option "reimport all"
     
  8. gamebytom

    gamebytom

    Joined:
    Mar 13, 2017
    Posts:
    10
    Hi, could I use this asset as a rich text editor? For example, select some part of the text and click on Bold, then select an overlapping bit of text and make it italic and slightly bigger font size?

    I guess I would use the LiveProcessingFilters for this looking at your description.

    Thanks!
     
    Last edited: Jan 10, 2019
  9. BennyTan

    BennyTan

    Joined:
    Jan 23, 2014
    Posts:
    141
    Hi, When trying to convert textmesh pro input fields to advance inputfields with tmp rendering, i get the following error and not all fields are converted

    Code (CSharp):
    1.  
    2. IndexOutOfRangeException: Index was outside the bounds of the array.
    3. AdvancedInputFieldPlugin.TMProTextRenderer.RefreshCharacterData () (at Assets/Plugins/Advanced Input Field/Scripts/InputField/TMProTextRenderer.cs:326)
    4. AdvancedInputFieldPlugin.TMProTextRenderer.RefreshData () (at Assets/Plugins/Advanced Input Field/Scripts/InputField/TMProTextRenderer.cs:219)
    5. AdvancedInputFieldPlugin.TMProTextRenderer.UpdateImmediately (System.Boolean generateOutOfBounds) (at Assets/Plugins/Advanced Input Field/Scripts/InputField/TMProTextRenderer.cs:197)
    6. AdvancedInputFieldPlugin.TMProTextRenderer.set_Text (System.String value) (at Assets/Plugins/Advanced Input Field/Scripts/InputField/TMProTextRenderer.cs:70)
    7. AdvancedInputFieldPlugin.AdvancedInputField.SetText (System.String text, System.Boolean invokeTextChangeEvent) (at Assets/Plugins/Advanced Input Field/Scripts/InputField/AdvancedInputField.cs:1095)
    8. AdvancedInputFieldPlugin.AdvancedInputField.set_Text (System.String value) (at Assets/Plugins/Advanced Input Field/Scripts/InputField/AdvancedInputField.cs:847)
    9. AdvancedInputFieldPlugin.Editor.AdvancedInputFieldExtensions.ApplyInputFieldData (AdvancedInputFieldPlugin.AdvancedInputField inputField, AdvancedInputFieldPlugin.Editor.InputFieldData data) (at Assets/Plugins/Advanced Input Field/Editor/Extensions/AdvancedInputFieldExtensions.cs:215)
    10. AdvancedInputFieldPlugin.Editor.AdvancedInputFieldExtensions.ApplyData (AdvancedInputFieldPlugin.AdvancedInputField inputField, UnityEngine.RectTransform sourceTransform, AdvancedInputFieldPlugin.Editor.InputFieldData inputFieldData, AdvancedInputFieldPlugin.Editor.TextRendererData textRendererData, AdvancedInputFieldPlugin.Editor.TextRendererData placeholderRendererData) (at Assets/Plugins/Advanced Input Field/Editor/Extensions/AdvancedInputFieldExtensions.cs:79)
    11. AdvancedInputFieldPlugin.Editor.ConversionToolWindow.ConvertTMProInputFieldsToAdvancedInputField (System.String prefabPath) (at Assets/Plugins/Advanced Input Field/Editor/ConversionToolWindow.cs:311)
    12. AdvancedInputFieldPlugin.Editor.ConversionToolWindow.ConvertInputFields () (at Assets/Plugins/Advanced Input Field/Editor/ConversionToolWindow.cs:150)
    13. AdvancedInputFieldPlugin.Editor.ConversionToolWindow.OnGUI () (at Assets/Plugins/Advanced Input Field/Editor/ConversionToolWindow.cs:122)
    14. System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <ac823e2bb42b41bda67924a45a0173c3>:0)
    15. Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    16. System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <ac823e2bb42b41bda67924a45a0173c3>:0)
    17. System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <ac823e2bb42b41bda67924a45a0173c3>:0)
    18. UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:342)
    19. UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:336)
    20. UnityEditor.HostView.OldOnGUI () (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:129)
    21. UnityEngine.Experimental.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:266)
    22. UnityEngine.Experimental.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:438)
    23. UnityEngine.Experimental.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:421)
    24. UnityEngine.Experimental.UIElements.IMGUIContainer.HandleEvent (UnityEngine.Experimental.UIElements.EventBase evt) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:401)
    25. UnityEngine.Experimental.UIElements.EventDispatcher.ProcessEvent (UnityEngine.Experimental.UIElements.EventBase evt, UnityEngine.Experimental.UIElements.IPanel panel) (at C:/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:511)
    26. UnityEngine.Experimental.UIElements.EventDispatcher.Dispatch (UnityEngine.Experimental.UIElements.EventBase evt, UnityEngine.Experimental.UIElements.IPanel panel, UnityEngine.Experimental.UIElements.DispatchMode dispatchMode) (at C:/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:307)
    27. UnityEngine.Experimental.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.Experimental.UIElements.EventBase e, UnityEngine.Experimental.UIElements.DispatchMode dispatchMode) (at C:/buildslave/unity/build/Modules/UIElements/Panel.cs:176)
    28. UnityEngine.Experimental.UIElements.UIElementsUtility.DoDispatch (UnityEngine.Experimental.UIElements.BaseVisualElementPanel panel) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:245)
    29. UnityEngine.Experimental.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:68)
    30. UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)
    31.  
    32.  
    This is on:
    Unity 2018.3.0f2
    Text Mesh Pro v1.3.0 (From Package Manager)
    Advance Input Field v1.7.1
     
    Last edited: Jan 11, 2019
  10. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Rich Text Editing is not supported yet, but I will probably start implementing the basic tags (bold, italic, underline,..) in February.
     
  11. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    I think the TextMeshPro binding of this plugin isn't properly configured. Usually the PackageManager of Unity is the cause (not linking the libraries properly). Did you follow the steps to configure TextMeshPro in the ReadMe?

    1. Install the TextMeshPro package from the PackageManager window in Unity:
    (Window => Package Manager)
    2. Find the TextMeshPro package in the list and install it
    3. Open the Player Settings in Unity
    (Edit => Project Settings => Player)
    4. In “Scripting Define Symbols” add the following value: ADVANCEDINPUTFIELD_TEXTMESHPRO
    5. Recompile (normally Unity does this automatically)
    6*. If it still doesn't work, it probably means that the Unity Package manager didn't add the reference to TextMeshPro properly to Visual Studio (this unfortunately sometimes happen). You can check if it got added correctly by trying to access a class from TextMeshPro in code. Removing and reinstalling TextMeshPro from the PackageManager usually works.
    7*. If the TMProTextRenderer still doesn't load, try the option "reimport all"
     
  12. BennyTan

    BennyTan

    Joined:
    Jan 23, 2014
    Posts:
    141
    Hi, I have removed and re-added text mesh pro a number of time, before AIF, after AIF, all tried.

    TMP is properly referenced in visual studio, the relevant class can be called and the dll can be found under references.

    Scripting symbol has been properly added in the build settings as well. Running the sample AIF/TMP "Chat" demo scene works fine and does not throw any errors.

    Could you please have another look and see where the error might be?

    PS. for those experiencing problems compiling TMProTextRenderer, there is something wrong with the class name. Overwrite the class name with the file name and it will compile properly. It has nothing to do with properly installing TMP. The author might want to check this out as well. Thank you!
     
  13. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Thanks for the update.
    It's weird that the sample scene does work, that would suggest that all the scripts are compiled and libraries are linked successfully.
    Did you perhaps upgrade from an earlier version of the plugin, maybe one of the prefabs got corrupted or an old prefab is still in there.

    I've tested it with steps:
    - Create a new empty project in Unity 2018.3.0
    - Install the plugin from the AssetStore
    - Followed the steps in the ReadMe to configure TextMeshPro
    - Tried to convert an Unity InputField to an AdvancedInputField with TextMeshPro Text using the ConversionTool
    - Got an error in the log (not that same as the one you posted before).
    - Used to option "reimport all" ("reimport" on the scripts folder of the plugin seems to work too).
    - Tried to convert the InputField again and the errors were gone.

    No idea what would be wrong the class name, maybe Unity doesn't want to recompile it without using the "reimport" option on the scripts folder of the plugin.
     
  14. BjoUnity3d

    BjoUnity3d

    Joined:
    Jul 24, 2012
    Posts:
    59
    I think I have the same problem as kickassqc or it's related. I'm using TextMeshPro Package 1.3.0. If I load the Chat example and try to type into the Placeholder Text field I get a Null Reference Exception every keypress.

    NullReferenceException: Object reference not set to an instance of an object
    AdvancedInputFieldPlugin.AdvancedInputField.set_PlaceHolderText (System.String value) (at Assets/Plugins/Advanced Input Field/Scripts/InputField/AdvancedInputField.cs:909)
    AdvancedInputFieldPlugin.Editor.AdvancedInputFieldEditor.DrawTextProperties (AdvancedInputFieldPlugin.AdvancedInputField inputField) (at Assets/Plugins/Advanced Input Field/Editor/AdvancedInputFieldEditor.cs:227)
    AdvancedInputFieldPlugin.Editor.AdvancedInputFieldEditor.OnInspectorGUI () (at Assets/Plugins/Advanced Input Field/Editor/AdvancedInputFieldEditor.cs:123)
    UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor[] editors, Int32 editorIndex, Boolean rebuildOptimizedGUIBlock, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1367)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)

    [Exception] NullReferenceException: Object reference not set to an instance of an object
    AdvancedInputField.set_PlaceHolderText() Assets/Plugins/Advanced Input Field/Scripts/InputField/AdvancedInputField.cs:909
    907: {
    908: placeholderText = value;
    -->909: PlaceholderTextRenderer.Text = placeholderText;
    910: UpdateActiveTextRenderer();
    911: }
    AdvancedInputFieldEditor.DrawTextProperties() Assets/Plugins/Advanced Input Field/Editor/AdvancedInputFieldEditor.cs:227
    225: {
    226: MarkTextRendererDirty(inputField.PlaceholderTextRenderer);
    -->227: inputField.PlaceHolderText = placeholderTextProperty.stringValue;
    228: }
    229: }
    AdvancedInputFieldEditor.OnInspectorGUI() Assets/Plugins/Advanced Input Field/Editor/AdvancedInputFieldEditor.cs:123
    121: EditorGUILayout.PropertyField(interactableProperty);
    -->123: DrawTextProperties(inputField);
    124: DrawCharacterLimitProperty(inputField);
    125: //DrawLineLimitProperty(inputField); //TODO: Reenable when line limit works on mobile too (requires partial rewrite native bindings)
    InspectorWindow.DrawEditor() C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1367
    GUIUtility.ProcessEvent()

    Also I'm seeing an error on TMProTextRenderer in the component. The associated script cannot be loaded. Please fix any compile errors and assign a valid script.

    I did already add the script symbols.
     
  15. BjoUnity3d

    BjoUnity3d

    Joined:
    Jul 24, 2012
    Posts:
    59
    Per BennyTan's suggestion, I renamed the TMProTextRenderer class, saved it and recompiled. It looked like it already matched the filename so I just changed it to TMProTextRendererTest. Then I tried removing/adding the script to the Text component in the Advanced Input TMPro prefab. Unity said nope, fix all compiler errors and make sure the name matches the filename. I then renamed the class back to what it looked like it was before (TMProTextRenderer) and saved/compiled. Then Unity would let me add it to the component. And also everything was fixed. Now I can edit the placeholder text with no errors and the TMProTextRenderer script shows without the error. Everything seems to be working normally now. Using Unity 2018.2 by the way. No idea why this worked but thanks BennyTan!
     
  16. BjoUnity3d

    BjoUnity3d

    Joined:
    Jul 24, 2012
    Posts:
    59
    I have another problem though. I tried using the IP Address validation option. It gives this error when typing into the field:

    [Exception] IndexOutOfRangeException: Array index is out of range.
    Util.LastIndexOf() Assets/Plugins/Advanced Input Field/Scripts/Helper/Util.cs:102
    100: for(int i = textLength - 1; i >= 0; i++)
    101: {
    -->102: if(text == ch) { return i; }
    103: }
    TextValidator.ValidateChar() Assets/Plugins/Advanced Input Field/Scripts/InputField/TextValidator.cs:195
    193: else if(Validation == CharacterValidation.IPAddress)
    194: {
    -->195: int lastDotIndex = Util.LastIndexOf('.', text, textLength);
    196: if(lastDotIndex == -1)
    197: {
    TextValidator.Validate() Assets/Plugins/Advanced Input Field/Scripts/InputField/TextValidator.cs:41
    39: {
    40: char ch = textToAppend;
    -->41: char result = ValidateChar(ch, buffer, position, position, caretPosition, selectionStartPosition);
    42: if(result != 0)
    43: {
    TextManipulator.Insert() Assets/Plugins/Advanced Input Field/Scripts/InputField/TextManipulator.cs:150
    148: selectionStartPosition = TextNavigator.SelectionStartPosition;
    149: }
    -->150: textValidator.Validate(Text, input, TextNavigator.CaretPosition, selectionStartPosition);
    151: string resultText = textValidator.ResultText;
    152: int resultCaretPosition = textValidator.ResultCaretPosition;
    TextManipulator.TryInsertChar() Assets/Plugins/Advanced Input Field/Scripts/InputField/TextManipulator.cs:206
    204: }
    -->206: Insert(c.ToString());
    207: }
    StandaloneTextInputHandler.ProcessKeyboardEvent() Assets/Plugins/Advanced Input Field/Scripts/InputField/StandaloneTextInputHandler.cs:163
    161: }
    -->163: TextManipulator.TryInsertChar(c);
    165: return true;
    StandaloneTextInputHandler.Process() Assets/Plugins/Advanced Input Field/Scripts/InputField/StandaloneTextInputHandler.cs:40
    38: if(keyboardEvent.rawType == EventType.KeyDown)
    39: {
    -->40: bool shouldContinue = ProcessKeyboardEvent(keyboardEvent);
    41: if(!shouldContinue)
    42: {
    AdvancedInputField.OnUpdateSelected() Assets/Plugins/Advanced Input Field/Scripts/InputField/AdvancedInputField.cs:2000
    1998: if(textNavigator.EditMode)
    1999: {
    -->2000: textInputHandler.Process();
    2001: textNavigator.UpdateSelected();
    ExecuteEvents.Execute() C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:99
    ExecuteEvents.Execute[IUpdateSelectedHandler]() C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:261
    EventSystem.Update()
     
  17. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    OK. That was a stupid mistake:
    In Util.cs in the method LastIndexOf(char ch, char[] text, int textLength):
    This:
    for(int i = textLength - 1; i >= 0; i++)

    Needs to be:
    for(int i = textLength - 1; i >= 0; i--)

    No idea why I didn't notice that before, seems to only be used for that specific CharacterValidation option

    Edit: Seems Android and iOS have the same problem, so in case you want to build for Android or iOS: Overwrite the NativeKeyboard.aar and NativeKeyboard.a files in Plugins/Android and Plugins/iOS with the ones in attached zip file.
     

    Attached Files:

    Last edited: Jan 18, 2019
    BjoUnity3d likes this.
  18. BennyTan

    BennyTan

    Joined:
    Jan 23, 2014
    Posts:
    141
    It couldn't have been an old version as I bought it when it was already v1.71

    I finally identified the source of my problem. The conversion tool does not want to convert the contents of my tmp_inputfield properly and errors. If i remove the content of my tmp_inputfield, the conversion works. So I think there are some content type which it doesn't handle properly. I didn't have time to figure out which part of the content was causing it (it was an informed consent sheet so had quiet abit of content), maybe later. If you want the content to test and figure it out let me know.

    Once again, its nothing to do with the installation of TMP.

    Comments/Requests:
    1: Multiline (newline) also dosen't handle line breaks properly in the editor... I had to replace all my line breaks with <br> to get my formatting back, but basically made it difficult to read/edit. Is there a better way to add line breaks in the editor?

    2: Deleting the entire game object and recreating during conversion might not be the best way. The new gameobject dosent contain any of the additional components added to the old gameobject such as "layout element" causing the layout to get messed up

    3: The created item is not place in the original position in the hierarchy but at the end. This once again messes up the layout. might want to get the position of the original gameobject and set the new object to the same child index

    4: unity and tmp uses "text" to access the contents of the inputfield, advanced input field uses "Text" resulting in required script edits to get it working again. more of a quality of life thing.

    Cheers
     
    Last edited: Jan 23, 2019
  19. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Thanks for the feedback/research.
    1. Currently not in the Editor. You have to do it from code. I did add this request to my TODO list.
    2. and 3. Added them to my TODO list as ConversionTool improvements.
    4. Probably won't change this. I use the default (Microsoft) C# Pascal case naming convention for properties in my code and also prefer this format, because it's more clear that you're accessing a property and not a public field.

    Not sure yet when I can work on those improvements (currently rewriting some code), but they are my TODO list.
     
  20. BennyTan

    BennyTan

    Joined:
    Jan 23, 2014
    Posts:
    141
    No Worries! I may sound like i'm pointing out problems, but in fact, its still tons better then the unity inputfield! Thank you very much for your hard work! Cheers!
     
  21. johmaxgro

    johmaxgro

    Joined:
    Oct 3, 2018
    Posts:
    10
    Hi,
    I'm not sure if this question has already been asked, but is it possible to hide the mobile keyboard (on screen keyboard) as well as the input box which appears on top of the keyboard on Android when the input field is focused?
    This seems to be a problem with the "native" Unity Input Field, like discussed here: https://forum.unity.com/threads/hide-mobile-input-does-not-work.481660/.

    I just want to double check if this is possible before I buy the asset, since I need exactly this functionality. I want to have the input field in world space and do the text input with an external bluetooth keyboard. If yes, this would be great.
     
  22. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    There isn't an input box on the top of the keyboard on Android, only the keyboard and optionally the suggestion bar (same for iOS).
    If you connect an external bluetooth keyboard, the on screen keyboard should get hidden.

    You can test this behaviour before buying the plugin, by installing one of the Android builds for the sample scenes of the plugin. (see first post of this thread).
     
  23. TheChosenBlob

    TheChosenBlob

    Joined:
    Feb 26, 2015
    Posts:
    6
    Hi,
    Great plugin! Thanks for all your hard work
    FYI, if you call SetText with null, it will cause exceptions in the TextNavigator.
     
  24. seliverstovvladislavpb

    seliverstovvladislavpb

    Joined:
    Feb 1, 2019
    Posts:
    2
    Hi, before I start using your plugin, i need to know, can I customize inputfields with my fonts, color and backgrounds?
     
  25. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Yes, the rendering of the InputField is done in Unity, so you can just modify the text font, color, background on the gameobject. Only the native keyboards of the mobile platform are rendered by native code.
     
  26. Vasilis-Mbakalis

    Vasilis-Mbakalis

    Joined:
    May 23, 2017
    Posts:
    16
    Hello, i want to add the action bars on my project's input field.Im trying to find a way to edit them (change font style,color etc etc...) and the current selection cursor and i cant.Is there a way?
     
  27. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    You can find/replace the ActionBar prefab that is used by the plugin by opening the Global Settings of the plugin. (TopBar: Advanced Input Field/Global Settings).

    In latest version (1.8.0) the ActionBar format & visuals have changed. Same for the Mobile Selection Cursors (dragging behaviour has been rewritten to behave more like the native behaviour). So you might want to update to version 1.8.0 and modify the prefabs further.
     
  28. Vasilis-Mbakalis

    Vasilis-Mbakalis

    Joined:
    May 23, 2017
    Posts:
    16
    Thank you!
     
  29. klgimbelkanda

    klgimbelkanda

    Joined:
    Jun 20, 2017
    Posts:
    1
    Hi, I bought the asset today and it's working out really great, but I had to perform a few changes in order to make it work for me:

    I am using .NET 4.x compiler, and I believe this bug https://issuetracker.unity3d.com/is...ith-without-a-space-after-the-number-if-logic is affecting some of your scripts, as after I added a space after all the #if's it compiled perfectly.

    There were some custom #define directives in the TMProTextRenderer which I granted didn't spend a lot of time examining, but while they were there it was falling back to the unimplemented TextRenderer, so I removed them.

    Other than that I can say that this asset does all I was looking for in an inputfield, so thanks for that!
     
  30. AtomicMarine

    AtomicMarine

    Joined:
    Nov 7, 2010
    Posts:
    53
    Hello, I seem to be having trouble to get this working in my build.

    When I create a new project everything is fine. However when I import the plugin into the my current build I don't get any errors but no Keyboard appears on my phone when I load the .apk. I think this has to do with the fact that I have a .xml file which is in Android/res/ which is used for NFC. How do I get the keyboards to work alongside this?
     
  31. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Thanks for the feedback.
    Regarding the first issue:
    I couldn't reproduce it with latest builds of the major releases. (2018.1.9, 2017.2.20, 2018.3.3 atm), so I guess Unity patched it in their newer builds.
    Regarding the second issue:
    Normally you would need to add the define "ADVANCEDINPUTFIELD_TEXTMESHPRO" yourself to the Scripting Define Symbols in the PlayerSettings after the TextMeshPro package has been imported (to avoid compiler errors). The instructions for adding TextMeshPro are also in the ReadMe of this plugin.
    Maybe it will be more clear if I replace those NotImplementedExceptions with a warning.
     
  32. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Which other plugin are you using that is causing the conflict?
    Are there any strange errors in the Android log of your device?
    Not really sure if it matters, but what Unity version are you using?
     
  33. AtomicMarine

    AtomicMarine

    Joined:
    Nov 7, 2010
    Posts:
    53
    @jpienbro

    I'm not using other plugins, It's some Android Java Objects I'm using myself in code to call some Android OS functions (specifically NFC).

    I'm using 2018.2 Unity. I might add that your demo version builds PERFECTLY with no errors and works perfectly, so it's definitely build specific. I might also add my project builds the .apk perfectly as well and throws no errors, the issue is that when I press the input field nothing happens, no Keyboard is brought up.

    My XML file looks like this:
    Code (CSharp):
    1. <?xml version="1.0" encoding="utf-8"?>
    2. <manifest
    3.     xmlns:android="http://schemas.android.com/apk/res/android"
    4.     package="com.unity3d.player"
    5.     xmlns:tools="http://schemas.android.com/tools"
    6.     android:installLocation="preferExternal"
    7.     android:versionCode="1"
    8.     android:versionName="1.0">
    9.  
    10.     <uses-permission android:name="android.permission.NFC" />
    11.     <uses-permission android:name="android.permission.USE_FINGERPRINT" />
    12.     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    13.     <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    14.     <uses-feature
    15.       android:name="android.hardware.nfc"
    16.       android:required="true" />
    17.  
    18.     <uses-sdk android:minSdkVersion="21"/>
    19.  
    20.     <supports-screens
    21.         android:smallScreens="true"
    22.         android:normalScreens="true"
    23.         android:largeScreens="true"
    24.         android:xlargeScreens="true"
    25.         android:anyDensity="true"/>
    26.  
    27.     <application
    28.         android:theme="[USER=863766]@StyLe[/USER]/UnityThemeSelector"
    29.         android:icon="@drawable/app_icon"
    30.         android:label="[USER=7078]@String[/USER]/app_name">
    31.         <activity android:name="com.unity3d.player.UnityPlayerActivity"
    32.                   android:label="[USER=7078]@String[/USER]/app_name"
    33.                   android:launchMode="singleTask"
    34.                   android:process=":unityplayer"
    35.                   android:windowSoftInputMode="adjustNothing">
    36.             <intent-filter>
    37.                 <action android:name="android.intent.action.MAIN" />
    38.                 <category android:name="android.intent.category.LAUNCHER" />
    39.             </intent-filter>
    40.                <intent-filter>
    41.                 <action android:name="android.nfc.action.NDEF_DISCOVERED" />
    42.                 <action android:name="android.nfc.action.TECH_DISCOVERED" />
    43.                 <action android:name="android.nfc.action.TAG_DISCOVERED" />
    44.                 <category android:name="android.intent.category.DEFAULT" />
    45.             </intent-filter>
    46.             <meta-data android:name="android.nfc.action.TECH_DISCOVERED" android:resource="[USER=94913]@XML[/USER]/nfc_tech_filter" android:value="true" />
    47.         </activity>
    48.     </application>
    49. </manifest>
    An extra point of clarity. When I import the package into my existing project and build it with the demo scene as the primary scene nothing happens in that scene.

    UPDATE FROM MY SIDE: It turns out by exporting my project out as a package, and placing it into a new project which has your plugin already installed I can then edit the .xml file of your plugin to do what I need and it works :).
     
    Last edited: Feb 8, 2019
  34. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    I couldn't really reproduce it:
    Opened Unity 2018.2.20, installed plugin from Asset Store, added your AndroidManifest.xml in the project and tried to build.
    Got some errors because of resources it couldn't find, so I modified the lines with "USER=94913" with a resource that should exist.
    Rebuild and installed on 3 of my test devices and keyboard shows normally (with only a slight delay on some devices the first time the keyboard got accessed).

    The AndroidManifest.xml of the Android side of the plugin doesn't contain much: Only a package declaration, no other settings. Don't know what the Unity Engine might add by default.

    The only thing that might have an influence on the keyboard is the "windowSoftInputMode", which by default is "adjustUnspecified" afaik, but as I said before "adjustNothing" doesn't seem to cause issues. (at least on my test devices).

    Glad to know you could fix it on your end though using a workaround.
     
  35. johmaxgro

    johmaxgro

    Joined:
    Oct 3, 2018
    Posts:
    10
    Hello,
    I want every first input char to be lowercase (if not intentionally entered as uppercase by pressing shift key). Autocapitalization type is "NONE". Nevertheless, the first input char gets upper case anytime. Is there any way to disable this behaviour? Maybe I just missed some configs.
    I already thought about creating a workaround within the OnValueChanged Event Listener. But just wanted to check if theres any provided way to achieve lowercase chars at beginning of inputs already.
     
  36. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Maybe you still have a CharacterValidation active on the InputField. The CharacterValidation option forces a specific format.
    Could you check the ContentType of the InputField? It should be "Standard" to disable CharacterValidation or "Custom" and then change the CharacterValidation option to "None" manually.
     
  37. johmaxgro

    johmaxgro

    Joined:
    Oct 3, 2018
    Posts:
    10
    Perfect, changing the ContentType to "Standard" works - ContentType was "Sentence" before.
    Thanks for the quick reply. Great support!
     
  38. jmansa

    jmansa

    Joined:
    Apr 13, 2012
    Posts:
    75
    Hi, really like this plugin... Solves a lot of issues :) Have one question though... When selecting text on iOS I would like to have a semi transparent area/image over what text I have selected. It does not appear to have this now? Am I missing a field, or is it coming in a future release? Also, how can I make the markers a bit smaller?

    Thanks in advance :)
     
  39. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    If you mean the text selection zoom overlay feature of iOS, that's not implemented yet.
    If you want to make the mobile selection cursors smaller. Go the Global Settings (TopBar: Advanced Input Field => Global Settings) and make the "MobileSelectionCursorsScale" a bit smaller.
     
  40. Sergey-Leluk

    Sergey-Leluk

    Joined:
    Mar 4, 2015
    Posts:
    8
    Hello, I have got a new version 1.8.0

    Situation 1)
    My existent project
    1 ) Deleted all previous file from AdvancedInputField
    2) Imported the new version
    3) Warning "The referenced script (AdvancedInputField) on this Behaviour is missing!"

    Hm,
    Situation 2)
    1) Create a new Unity project
    2) Import Advanced Input Filed
    3) Import TextMeshPro
    4) Open your scene "Form"
    5) Start
    The same warning

    I ask my friend to do the same -
    result is similar

    What's wrong?

    Unity 2018.3.1f1
     
    Last edited: Feb 14, 2019
  41. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    I could reproduce the issue in Unity 2018.3.1.
    In Unity 2018.3.3 it seems to work (newer probably works too), probably because the AssetStore picked the package for Unity 2018.2.20, because the later version I used for building the package is Unity 2018.3.3.
    I think Unity changed the MonoBehaviour format starting Unity 2018.3.0.
     
  42. Sergey-Leluk

    Sergey-Leluk

    Joined:
    Mar 4, 2015
    Posts:
    8
    Ok, Thank you. I have set Unity 2018.3.6 .
    Everything is working.
     
  43. johmaxgro

    johmaxgro

    Joined:
    Oct 3, 2018
    Posts:
    10
    Hello,

    I am currently facing an issue and would need some help.

    I have set the text alignment of my Advanced Input Field to center, but when I select the input field (via ManualSelect()), the caret is not in the center of the field, but on the start (left side). Caret On Begin Edit is set to END_OF_TEXT. Can I manipulate this somewhere so that caret starts blinking in the middle of the field (even though the width is ~equals the screen width)?


    Thanks
     
    Last edited: Feb 22, 2019
  44. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Does your input field have no text or does it already have text in it when calling ManualSelect()?
    Which Text Renderers are you using? Unity Text or TextMeshPro Text? (You can see this in the inspector of the AdvancedInputField instance)
     
  45. johmaxgro

    johmaxgro

    Joined:
    Oct 3, 2018
    Posts:
    10
    I am using Unity Text in one scene and TextMeshPro in the other. It does not have any text when calling ManualSelect(). Same for both, Unity Text and TextMeshPro. I tried to find a workaround, but have not successful until now.

    I am also facing another issue at the moment, maybe you could also help me here:
    I am using the Advanced Input Field in a VR Scene on Android (together with a Cardboard Viewer). I select the Input Field manually via Enter key press on an external bluetooth keyboard. After a while the Input Field gets deselected by itself. I found out that this probably has to do with touch input on the smartphone screen (since I am getting USER_DESELCT as EndEdit Reason) --> So I need to disable the Input Field select/deselect getting triggered by touch input. It only should get selected and deselected by script. Is there any direct way to do this (to prevent selection via touch) for the Advanced Input Field?

    Thanks in advance
     
    Last edited: Feb 23, 2019
  46. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    For that first issue: couldn't reproduce it myself, but you might have forgotten to change the text alignment of the other text renderers (Processed and PlaceHolder GameObject). The Placeholder renderer will be used whenever the text is empty.

    For that second issue: that's an interesting combination. Never tried this myself in VR, but I know that some of the VR headsets have buttons that get registered as touch events. You might be able to block the deselect by adding some custom code to the DelayedDeselect() method in AdvancedInputField.cs. That method is used to check if the deselect is valid and reselects it when the deselect was not valid. (for example: ActionBar button presses). If you really want to block all touch input, you could comment out the body of the OnPointer methods in AdvancedInputField.cs
     
  47. LuizBenetonScopely

    LuizBenetonScopely

    Joined:
    Jan 14, 2019
    Posts:
    7
    Hi there, I just faced an interesting problem when adding this plugin to my project.

    5 files that should extend MonoBehaviours were not recognized as MonoBehaviours by Unity and so I could not add them to my GameObjects. One of them was AdvancedInputField.
    I noticed that when re-importing the files I would get 5 errors like the following:

    Code (CSharp):
    1. InvalidOperationException: Stack empty.
    2. System.Collections.Generic.Stack`1[T].ThrowForEmptyStack () (at <ac210d81537245bc838518cc8e845861>:0)
    3. System.Collections.Generic.Stack`1[T].Pop () (at <ac210d81537245bc838518cc8e845861>:0)
    4. UnityEditor.Scripting.ScriptCompilation.CSharpNamespaceParser.EvaluateBool (System.String expression) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/CSharpNamespaceParser.cs:284)
    5. UnityEditor.Scripting.ScriptCompilation.CSharpNamespaceParser.EvaluateBooleanExpression (System.String expression) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/CSharpNamespaceParser.cs:250)
    6. UnityEditor.Scripting.ScriptCompilation.CSharpNamespaceParser.EvaluateDefine (System.String expr, System.Collections.Generic.ICollection`1[T] defines) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/CSharpNamespaceParser.cs:241)
    7. UnityEditor.Scripting.ScriptCompilation.CSharpNamespaceParser.RemoveUnusedDefines (System.String source, System.Collections.Generic.List`1[T] defines) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/CSharpNamespaceParser.cs:182)
    8. UnityEditor.Scripting.ScriptCompilation.CSharpNamespaceParser.RemoveIfDefs (System.String source, System.Collections.Generic.IEnumerable`1[T] defines) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/CSharpNamespaceParser.cs:159)
    9. UnityEditor.Scripting.ScriptCompilation.CSharpNamespaceParser.GetNamespace (System.String sourceCode, System.String className, System.String[] defines) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/CSharpNamespaceParser.cs:42)
    10. Rethrow as IllegalNamespaceParsing: Searching for classname: 'AdvancedInputField' caused error in CSharpNameParser
    11. UnityEditor.Scripting.ScriptCompilation.CSharpNamespaceParser.GetNamespace (System.String sourceCode, System.String className, System.String[] defines) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/CSharpNamespaceParser.cs:48)
    12. UnityEditor.Scripting.Compilers.CSharpLanguage.GetNamespaceNewRuntime (System.String filePath, System.String definedSymbols) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Scripting/Compilers/CSharpLanguage.cs:73)
    13. UnityEditor.Scripting.Compilers.CSharpLanguage.GetNamespace (System.String filePath, System.String definedSymbols) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Scripting/Compilers/CSharpLanguage.cs:122)
    14. UnityEditor.Scripting.ScriptCompilers.GetNamespace (System.String file, System.String definedSymbols) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilers.cs:101)
    15.  

    Fan fact: THIS DIDN'T HAPPEN ON A EMPTY PROJECT!
    So I believe this is an issue that arrises on big projects with many namespaces (like mine).

    I've found this post:
    https://forum.unity.com/threads/edi...cripting-scriptcompilers-getnamespace.583342/

    And it actually solved the issue.
    I changed the code on the plugin to make it work for my project and it seems to be ok now.

    It would be awesome if you could make those small changes on the project for the next update ;)

    Thanks!
     
  48. LuizBenetonScopely

    LuizBenetonScopely

    Joined:
    Jan 14, 2019
    Posts:
    7
    Oh I noticed I didn't list the 5 files for you:
    'ChatControl'
    'ChatView'
    'ModesControl'
    'AdvancedInputField'
    'KeyboardScroller'
     
  49. fennecx_development

    fennecx_development

    Joined:
    Sep 24, 2014
    Posts:
    427
    Thank you for the report.
    Strange that Unity doesn't notice these kind of things themselves in their own test projects or are you using a beta version of Unity?
    Which version of Unity are you actually using at the moment?
    I'll try to reproduce it in that version of Unity then, so I can verify if I fixed everything correctly.
     
  50. johmaxgro

    johmaxgro

    Joined:
    Oct 3, 2018
    Posts:
    10
    Thanks a lot for your help, I could resolve the issue No 1. Setting the alignment of the other renderers (Processed + Placeholder) did it for me.

    I also resolved issue No 2, my viewer really has two rubber plugs for holding the phone probably. I just removed them, now everything works...:)

    One last issue I have is when I select the Input Field manually, there appears a small grey, slightly transparent rectangle at the top left of the screen (here the link to the screenshot: https://drive.google.com/file/d/1aT_H1l70QuEBZpm6DIEGmvsAEXiEym3K/view?usp=sharing). Furthermore I use a bluetooth keyboard for input. I guess this has to be something from the OS side. After I made the screenshot on my phone this rectangle disappeared (phone is a Google Pixel 2 XL).