delete gui texture

I want to show a texture when i hit a trigger, then delete the texture when I exit the trigger.

I’ve got the GUI.DrawTexture working, but now I need to get it to UNdraw the texture. How do I do this?

var slide : Texture2D;

function OnTriggerEnter (col : Collider) {
	print("On Ducts");
	
	position = Rect(0,0,Screen.width,Screen.height);
	GUI.DrawTexture( position, slide );
	
}
function OnTriggerExit (col : Collider) {
	print("Off Ducts");

}

Ok, still trying to get this figured out. The goal is, when I run over a trigger, an image flies in from the left, and when I leave the trigger, the image flies back out to the left. And I have 12 different triggers, all with their own images.

So far I can get the GUI.DrawTexture to create the images on the screen. but I’m having troubles animating them on and off the screen using a trigger.

How do I go about this?

Ok, here’s what I’ve tried lately.

I have an object with the following script attached.

var showSlideOne : boolean;
var showSlideSeven : boolean;

var slide01 : Texture2D;
var slide07 : Texture2D;

var position01 : Rect;
var position07 : Rect;

function Start ()
{
	var CurrentX_01 = 0.0;
	var CurrentX_07 = 0.0;

	position01 = Rect(CurrentX_01,0,1024,768);
	position07 = Rect(CurrentX_07,0,1024,768);
	
}

function OnGUI () {
	
	if (showSlideOne) {
		GUI.DrawTexture( position01, slide01 );
	}
	if (showSlideSeven) {
		GUI.DrawTexture( position07, slide07 );
	}
}

Then I have the following script attached to the collider object.

function OnTriggerEnter (col : Collider) {
	print("On Ducts");
	
	showSlideSeven = true;
	
}
function OnTriggerExit (col : Collider) {
	print("Off Ducts");
	
	showSlideSeven = false;
}

The trigger doesn’t show or hide the images, but the print commands work. Can anyone tell me why, and how to fix the images triggering?

Answered at http://answers.unity3d.com/questions/43982/how-do-i-trigger-gui-elements