Closed Jared-Gross closed 3 years ago
I guess it could be cuz you setup align for your TMP input field. Try to refactor InitProcess method like that: https://pastebin.com/aU3dsxcv
I get an error when I add that to InitializeOnNextFrame()
Assets\Scripts\UnityMobileInput\MobileInputField.cs(298,33): error CS0103: The name 'UnicodeCategory' does not exist in the current context
It's set up as an IEnumerator
Yours is setup as a void
.
EDIT
Here is how the function looks on my end.
/// <summary>
/// Initialization coroutine
/// </summary>
private IEnumerator InitialzieOnNextFrame () {
// yield return null;
// this.PrepareNativeEdit ();
// #if (UNITY_IOS || UNITY_ANDROID) && !UNITY_EDITOR
// this.CreateNativeEdit ();
// this.SetTextNative (this._inputObjectText.text);
// _inputObject.placeholder.gameObject.SetActive (false);
// _inputObject.enabled = false;
// _inputObjectText.enabled = false;
// #endif
yield return null;
this.PrepareNativeEdit ();
#if (UNITY_IOS || UNITY_ANDROID) && !UNITY_EDITOR
this.CreateNativeEdit ();
string data = this._inputObjectText.text.Trim ();
if (data.Length == 1) {
UnicodeCategory category = Char.GetUnicodeCategory (data[0]);
if (category != UnicodeCategory.Format) {
this.SetTextNative (this._inputObjectText.text);
}
}
_inputObject.placeholder.gameObject.SetActive (false);
_inputObject.enabled = false;
_inputObjectText.enabled = false;
#endif
}
Did you add namespaces System.Globalization and System?
Works fantastic!
For future viewers summary.
Change the InitialzieOnNextFrame ()
in MobileInputField.cs
from:
/// <summary>
/// Initialization coroutine
/// </summary>
private IEnumerator InitialzieOnNextFrame () {
yield return null;
this.PrepareNativeEdit ();
#if (UNITY_IOS || UNITY_ANDROID) && !UNITY_EDITOR
this.CreateNativeEdit ();
this.SetTextNative (this._inputObjectText.text);
_inputObject.placeholder.gameObject.SetActive (false);
_inputObject.enabled = false;
_inputObjectText.enabled = false;
#endif
}
To:
/// <summary>
/// Initialization coroutine
/// </summary>
private IEnumerator InitialzieOnNextFrame () {
yield return null;
this.PrepareNativeEdit ();
#if (UNITY_IOS || UNITY_ANDROID) && !UNITY_EDITOR
this.CreateNativeEdit ();
string data = this._inputObjectText.text.Trim ();
if (data.Length == 1) {
UnicodeCategory category = Char.GetUnicodeCategory (data[0]);
if (category != UnicodeCategory.Format) {
this.SetTextNative (this._inputObjectText.text);
}
}
_inputObject.placeholder.gameObject.SetActive (false);
_inputObject.enabled = false;
_inputObjectText.enabled = false;
#endif
}
Don't forget to add using System.Globalization;
and using System;
at the top of the script.
This a complicated issue to explain. Here are images. https://imgur.com/a/YjlMA5G
So what happens is this: I start the app, and I try and search for something, but it tells me that I must type at least 2 letters. They way my searching is setup starts with at least 2 letters, if it only shows one letter, that message shows. (That back button should also not be there on the first image) Removing the MobileInputField removes the weird character from startup.
How do I reset it? Selecting the InputField and pressing backspace once, then everything works as expected perfectly! But this issue is for ever single InputField in my project.
Not sure if I explained this well, but that's sorta all there is.
Here is what I've tried. I tried looping over each InputField and clearing the text:
This looked like it would work, but, this did not work, the weird character is still there.
I was wondering if I would change this line to equal an empty string instead of
value
I'm stumped with this issue, please help.