Hi,
I got the following situation. There’s a box on my scene. If the player touches the box, the box will be deleted and an image has to appear on the screen.
So when I play the game and touch the box, the box will be destroyed but the image won’t appear on the screen. However, if I take out the line to destroy the box, it does work. But I need the box removed too!
This is my script right now:
var show : boolean;
var GUI_Key : Texture2D;
function Start(){
show = false;
}
function OnTriggerEnter (other : Collider) {
//Get the item by touching it, then destroy the item
Destroy(gameObject);
//Put item image on screen
show = true;
}
function OnGUI () {
if(show){
GUI.DrawTexture(new Rect(10,10,40,39), GUI_Key);
}
}