I'm making an RPG in Unity3D and I am trying to make a script for a chest to open. So I built this script! But it doesn't work. I just want some help fixing this script.
#pragma strict var Text : GameObject; var OpenedChest : GameObject; var CurrentChest : GameObject; function OnTriggerEnter() { Text.SetActive(true); if (Input.GetKeyDown("e")) { CurrentChest.SetActive(false); OpenedChest.SetActive(true); } } function OnTriggerExit() { Text.SetActive(false); } I get no compiler errors. When I go into the collider that triggers the text, that works, but what doesn't is when I press E to open the chest. It doesn't activate the other chest. What is wrong with my script?