How to Input name?

Announcements, support questions, and discussion for the Dialogue System.
mac
Posts: 81
Joined: Sat Aug 22, 2020 7:54 pm

Re: How to Input name?

Post by mac »

Yes, I probably didn't explain it well but your answer is exactly what I needed, thank you Tony.
User avatar
Tony Li
Posts: 22098
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to Input name?

Post by Tony Li »

Glad to help!
Edla
Posts: 27
Joined: Mon May 04, 2020 9:23 pm

Re: How to Input name?

Post by Edla »

I have a question about the name input.
How do you validate the input text, now blank spaces are accepted.

Is there a way to validate the input?
User avatar
Tony Li
Posts: 22098
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to Input name?

Post by Tony Li »

You can set up different StandardUIInputField GameObjects. That's why you specify the GameObject name (e.g., "Text Field UI") in the TextInput() sequencer command.

Each StandardUIInputField can set its Input Field component's Content Type (Standard, Alphanumeric, etc.). So that's your first stage of validation.

If you need to validate further, you can write a C# method to validate the player's input. Then register that C# method with Lua, and use it to loop back if the input isn't valid:

validateTextInput.png
validateTextInput.png (16.25 KiB) Viewed 673 times
Post Reply