Call guiTexture

Hi guys i was wandering how i can call a gui texture either by trigger or bollean. The problem i am having is. When i hit a checkpoint i want a texture to appear on screen then wait 3 seconds and dissapear. Or by trigger so when i am in the trigger show the texture wait the 3 seconds or until i have exited then dissapear here is a small script i have wrote but still doesnt work i get an error (there is no guiTexture attached to the gameObject )

var checkPic1 : Texture2D;

function OnTriggerEnter(hit : Collider)
{
	if(hit.gameObject.tag == "Player")
		{
			guiTexture.texture = checkPic1;
		}
}

function OnTriggerExit (exit : Collider)
{
	if(exit.gameObject.name == "Player")
		{
			Destroy(gameObject);
		}
}

first make your texture what you want and where you want it on screen to show up then in the inspector click the tick check mark so that it is disabled and doesn’t show up,
then put this in your script

var YourTexture : GUITexture;

function OnTriggerEnter(hit : Collider){
    if(hit.gameObject.tag == "Player")
        {
            YourTexture.enabled = true; //make sure you set this to flase in the inspector as I said before else it will do nothing
            yield WaitForSeconds(3);
            YourTexture.enabled = false;
        }
}

Scribe

P.S your getting that error because I presume you attacked this to the checkpoint or trigger collider and you therefore have to chose which object the GUITexture is. using guiTexture presumes that the script is attacked to a GUITexture object

Hi guys, i had a try of this code but doesnt seem to work at all… i understand that this is ol. I attaacht the gui texture as a child of the fps camera, disable it. Attach the script to a cube with trigger… i walk through it and nothing :confused: any idea? Sorry ive tried my own script and failed so i looked on here, this one seems promising, the code looks like it should work :confused: