When I'm enter into my Tptext(2) then press "E" my canvas will show dialogue, but when I walk into another Tptext(3) it doesn't work.
调用htmlpublic GameObject readCV;
public GameObject Teext;
public bool guishow = false;
string Readstr = "too high";
void Update(){
if(guishow == true && Input.GetKeyDown(KeyCode.E)){
Reader();
}
else if(Input.anyKeyDown)
{
readCV.SetActive(false);
}
}
private void OnTriggerEnter2D(Collider2D other)
{
guishow = true;
}
private void OnTriggerExit2D(Collider2D other)
{
guishow = false;
}
void Reader(){
Teext.GetComponent<UnityEngine.UI.Text>().text = Readstr;
readCV.SetActive(true);
}
ps.sorry for my bad language