jeudi 24 août 2017

Simple if between two strings fails

I'm having an issue with a simple IF statement:

string a = GameObject.Find("Text").GetComponent<TextMeshProUGUI>().text;
Debug.Log(a);
if (a == "test")
   GameObject.Find("PracticeButton").GetComponent<Button>().enabled = true;

The expression evaluates as false even thou i can clearly see that the values are the same. right and left side are equal

Does anyone have any idea why this happens? I've tried String.Equals but have the same result.

Aucun commentaire:

Enregistrer un commentaire