How can I attach a MaterialUI Text Validator to the new prompt dialog?

+1 vote
asked Apr 25, 2016 in Help by hroland (380 points)
How should I do it? I'm calling the dialog by DialogManager.ShowPrompt.

2 Answers

0 votes
answered May 2, 2016 by admin (31,720 points)
selected May 2, 2016 by hroland
Best answer

I'm just adding more info here :)

As Declan said, you need to use CreatePrompt etc... and after you have an instance of the dialog, you can just do that:

yourPromptDialog.firstInputField.customTextValidator = new EmptyTextValidator();
yourPromptDialog.secondInputField.customTextValidator = new EmptyTextValidator();

Of course you replace the "new EmptyTextValidator();" with another validator. You can see the tutorial on input fields here:

~ Yohan

commented May 2, 2016 by hroland (380 points)
Thank you! :)
0 votes
answered Apr 25, 2016 by admin (31,720 points)
Hey there,

If you call DialogManager.CreatePrompt(), it will give you a reference to the prompt object. You can then call Initialize() on it to set the same things you would with .ShowPrompt(). Then, before calling Show() , you can modify anything on it that you want. Methods such as GameObject.GetChildByName<T>() (GameObject extension method, stuff like this will be more easily discoverable once we release our documentation) might help you get the references to the objects you want.

Let me know if that's what you were looking for :)

~ Declan.
commented May 2, 2016 by hroland (380 points)
Thank you! :)
Welcome to MaterialUI support! Ask us anything :)