-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
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:
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.