I’m probably missing something really simple but I am unable to collect the text that is entered into a password field, I only get the *'s.
My code looks like this:
Text txtPass
txtPass = rtPass.GetComponent<Text>();
string strPass = txtPass.text;
And when I enter the word password into the input field strPass contains “********” so how do I get out “password”?
Thanks.
Use InputField.value instead of .text…
Text txtPass
txtPass = rtPass.GetComponent<Text>();
string strPass = txtPass.value;
Develop once, publish everywhere! Unity is the ultimate tool for video game development, architectural visualizations, and interactive media installations - publish to the web, Windows, OS X, Wii, Xbox 360, and iPhone with many more platforms to...
As a FYI this is changing for the next release as everyone seems to confuse text for what they need to use. The new names are .text (replaces .value) and .textComponent (replaces .text). This also make it more uniform to Text.text
I got mixed up because I was using the Text item that was a child of the InputField instead of the InputField itself.
This works:
InputField ifPass
ifPass = rtPass.GetComponent<InputField>();
string strPass = ifPass.value;
sridevi
September 20, 2015, 10:48am
5
i have created inputField and script attached to this .i am getting the error “rtPass” doesn’t exist in the current context