Page 2 of 2
Re: How to Input name?
Posted: Mon Apr 25, 2022 11:43 pm
by mac
Yes, I probably didn't explain it well but your answer is exactly what I needed, thank you Tony.
Re: How to Input name?
Posted: Tue Apr 26, 2022 8:35 am
by Tony Li
Glad to help!
Re: How to Input name?
Posted: Tue Apr 26, 2022 10:18 pm
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?
Re: How to Input name?
Posted: Tue Apr 26, 2022 10:33 pm
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 (16.25 KiB) Viewed 674 times