如果两个字符串之间的错

时间:2017-08-24 16:28:31

标签: c# .net if-statement unity3d

我遇到一个简单的IF语句问题:

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

表达式评估为false,即使您可以清楚地看到值是相同的。 right and left side are equal

有谁知道为什么会这样? 我尝试过String.Equals,但结果相同。

0 个答案:

没有答案