Hey all. I just made this script. I want to make it so that when the Player clicks a piece of paper (cube with collider), a gameobject with a GUItexture displays. Then when the Player is finished reading it, they can press "E" to close (delete gameobject). This is the script I have:
var texture : GameObject; //place your guitexture here
function Start() {
texture.enabled = false;
}
function OnMouseDown(GameObject.FindGameObject("paper") {
texture.enabled = true;
}
function Update() {
if(Input.GetKeyDown (KeyCode.E))
{
texture.enabled = false;
}
}
It's not working though, and I'm not sure how to make it work. The GUI texture is a seperate gameobject. Do I need to parent it to the paper? Or am I missing something?
↧