- Home /
Why a Text object will not show inside an if statement
This script is to change your password. In order to change, you must have the original password and confirm the password before it will change it. I want to display the status of the message that comes back from my www.text. If it reads this then display that. If it displays that, then show this.
I had it check to see if the passwords are both the same and the results shows up without a problem. Only when I try to display what comes back from the server, it doesn't display anything. What am I doing wrong? I did the exact same thing in another script and it worked just fine. I could use an extra pair or eyes. Status.text is the Text object.
string statustext = www.text;
if (statustext == "You are an Admin, please change your password through the Web Application!")
{
Status.text ="You are an Admin, please change your password through the Web Application!";
ClearInfo ();
}
else if (statustext == "Password is Changed to $npassword!")
{
Status.text = "Password is now changed to: "+ PasswordInputNew.text + "!";
yield return new WaitForSeconds (5);
ClearInfo ();
Status.text="";
}
else if (statustext == "")
{
Status.text ="There is no user by that username!";
yield return new WaitForSeconds (5);
ClearInfo ();
Status.text="";
}
Thanks!
Can you try switching your if statements to use string.Equals? if(statustext.Equals("whatever") == true) { // Code } if(string.IsNullOrEmpty(statustext) == true) { // Code }
If you debug log in your conditions do you see anything?
Answer by Gilead7 · Jun 13, 2019 at 03:19 PM
D'OH! The echo statement in the php script wasn't the same, no wonder it didn't show up! Thanks k234234!
Your answer
![](https://koobas.hobune.stream/wayback/20220612203103im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Making a bubble level (not a game but work tool) 1 Answer
An OS design issue: File types associated with their appropriate programs 1 Answer
Getting info using WWW & PHP 3 Answers