Accept TextInput With Mobile Keyboard

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
BigfootNick
Posts: 7
Joined: Fri Oct 14, 2022 7:42 pm

Accept TextInput With Mobile Keyboard

Post by BigfootNick »

Hello! I followed the https://www.pixelcrushers.com/phpbb/vie ... ard#p22494 HowTo on accepting TextInput with a mobile keyboard, but it's not working for me!
I started out using the standard template, but switched to Focused and having same problem.

My menu text originally said:
Tell him your name [var=?playerName]
which worked great when testing in Unity, but in IOS the return/done button wouldn't let me accept the input.

Followed these instructions:
To accept the user's input, configure a UI Button to call the Standard UI Input Field's AcceptTextInput method.
So I created a button under the Text Field Panel, and mapped OnClick() to AcceptTextInput.

Tried using sequencing:
TextInput(InputField,Your Name,playerName)

Now it seems to lock up in ios, but when testing in Unity I can tap Escape and cancel out.
User avatar
Tony Li
Posts: 21965
Joined: Thu Jul 18, 2013 1:27 pm

Re: Accept TextInput With Mobile Keyboard

Post by Tony Li »

Hi,

> My menu text originally said:
> Tell him your name [var=?playerName]
> which worked great when testing in Unity, but in IOS the return/done button wouldn't let me accept the input.


In iOS, what does the return/done button do? Nothing?

Does your own UI button show a transition when you click on it? UI Button components have a Transition section that by default changes the tint of the button. When you press down on the button, it should tint the button to the color you specified for Pressed.


> Tried using sequencing:
> TextInput(InputField,Your Name,playerName)


Is your Standard UI Input Field component on a GameObject named InputField? In the dialogue UI prefabs that ship with the Dialogue System, this GameObject is named "Text Field UI" (with spaces). Can you try that? In other words:

TextInput(Text Field UI, Your Name, playerName)

Are there any errors or warnings in the Console window?
BigfootNick
Posts: 7
Joined: Fri Oct 14, 2022 7:42 pm

Re: Accept TextInput With Mobile Keyboard

Post by BigfootNick »

Does your own UI button show a transition when you click on it?
Now that you mention it... no, it doesn't. When I click on the button (or the text) it's like something is sitting in front of it.
is named "Text Field UI" (with spaces). Can you try that?
I just changed it, but with the same results. I seem to have messed something up, because even clicking the text field now makes the whole text area go inactive, like I've clicked on an object in front of it. The only way past, with a physical keyboard, is pressing Escape.
Are there any errors or warnings in the Console window?
The only warning I have is from the Visual Effect Graph package that I added after I was already having a problem with this.
BigfootNick
Posts: 7
Joined: Fri Oct 14, 2022 7:42 pm

Re: Accept TextInput With Mobile Keyboard

Post by BigfootNick »

I went to a completely different Dialogue UI (WRPG) and the button works. Going to build this and see what happens on iPhone.
BigfootNick
Posts: 7
Joined: Fri Oct 14, 2022 7:42 pm

Re: Accept TextInput With Mobile Keyboard

Post by BigfootNick »

That new build worked, so I'll go back and try to find what I did to the Focus conversation UI.
BigfootNick
Posts: 7
Joined: Fri Oct 14, 2022 7:42 pm

Re: Accept TextInput With Mobile Keyboard

Post by BigfootNick »

Focus Template Standard Dialogue UI ironically loses focus when I click on it to type. I tried overwriting the Prefab template (..Assets\Plugins\Pixel Crushers\Dialogue System\Prefabs\Standard UI Prefabs\Templates\Focus\) with one from another project, but still happening to me, so I'll probably just use a different dialogue system UI, unless you have ideas of something else to check.

Either way, your Dialogue System is amazing. My jaw dropped when I saw it in the Unity store because it was just the type of thing that I had been trying to write up from scratch for so long.
BigfootNick
Posts: 7
Joined: Fri Oct 14, 2022 7:42 pm

Re: Accept TextInput With Mobile Keyboard

Post by BigfootNick »

Here's what it looks like. The button disappeared when I copied over a vanilla copy of the template, but it still grays out anyways.
Attachments
Lost Focus.png
Lost Focus.png (13.51 KiB) Viewed 296 times
User avatar
Tony Li
Posts: 21965
Joined: Thu Jul 18, 2013 1:27 pm

Re: Accept TextInput With Mobile Keyboard

Post by Tony Li »

Thanks! I'm glad you're liking the Dialogue System!

A few notes:

If you want to prevent the input field from starting with the value "nil", you can do one of two things:
  • Define the playerName variable in your dialogue database. (In the Dialogue Editor window's Variables tab.)
  • Or use the 'clear' option in your TextInput command, like: TextInput(Text Field UI, Your Name, playerName, , clear)
    There's a blank argument between the playerName and clear arguments. That's for max length, which I've left unspecified in this example.
To keep the input field focused, inspect the Dialogue Manager GameObject. Tick the Input Device Manager component's Always Auto Focus checkbox. (When this checkbox is UNticked, if the game detects that you're using a mouse it won't auto-focus UI elements such as the input field.)


> it still grays out anyways

Hmm, looks like on the Focus Template Standard Dialogue UI's Text Field UI > Text Field Panel > Canvas Group component, Blocks Raycasts accidentally got unticked. I'll make sure that's fixed in the prefab in version 2.2.33.

Here's an example scene in which it's fixed:

DS_TestInputExample_2022-10-17.unitypackage

Losing focus is a quirk (ironically, as you put it) with the Focus Template Standard Dialogue UI prefab. I'll address that in version 2.2.33 also.
BigfootNick
Posts: 7
Joined: Fri Oct 14, 2022 7:42 pm

Re: Accept TextInput With Mobile Keyboard

Post by BigfootNick »

That fixed it! Everything is working, and I'm so glad to be able to stick with that focus theme. Thanks!

After this game is released I'll have to try out your Love/Hate system for version 2 of the game. 👍
User avatar
Tony Li
Posts: 21965
Joined: Thu Jul 18, 2013 1:27 pm

Re: Accept TextInput With Mobile Keyboard

Post by Tony Li »

Glad to help! :-)
Post Reply