how to add time ? (how to show a guiTexture and hide it after some time?)

good day !! …help please … how to add time when the character destroy the object …

function OnTriggerEnter (other : Collider) {
  Destroy(gameObject);
  gameObject.Find("balisong").GetComponent("GUITexture").enabled = true;
} 

-this is my code when i destroy the object. Where i place the code of adding time . and how? thank you so much

COMMENTS POSTED AS ANSWERS AND MOVED HERE/DELETED (by aldonaletto):

1- thankyou ! i’ll try it :slight_smile:

2- how to disapper the guitexture after seconds. ? not the gameobject …

3- how to disappear the GUITexture when the gameobject destroy? for example … when the character destroy the object the guitexture will appear but after 5 seconds the guitexture will disappear … thx …!

Add time to what? If you want to delay the object destruction, you can use something like this:

Destroy(gameObject, 5); // destroy after 5 seconds

EDITED:
Ok, so you want to enable the GUITexture and disable it after some delay. The best alternative is to create a function in the “balisong” object, and modify the script below to call it. Let’s suppose the script attached to balisong is called BalisongScript.js (change the GetComponent argument if the script has a different name):

function OnTriggerEnter (other : Collider) {
  Destroy(gameObject);
  // call the function Show in the BalisongScript.js
  GameObject.Find("balisong").GetComponent(BalisongScript).Show();
} 

In the balisong object, add the code below to its script - or create a new script, if it has none:

function Show() {
  guiTexture.enabled = true; // enable the guitexture
  yield WaitForSeconds(5);   // 5 seconds delay
  guiTexture.enabled = false; // disable guiTexture
} 

NOTE: The Your Answer box must be used only to post answers to your question - use the minuscule add new comment button in the question or answers to post replies or comments.