I want an image to fly in from the left screen when I run over a trigger object in my scene, then animate back out to the left when I exit the trigger collider.
Nothing I'm trying is working. The latest thing I've tried is, 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?