Am i too annoyed already to think right? Because I CAN’T DO THIS! Ahh i am so furious! I am literally trying to figure out what am i doing wrong and i can’t anymore ‘-’
I want to make a prefab/object be deleted after a few seconds. Like, 1… 2… 3… it doesn’t exists anymore. But i can’t. I receive a “Uknkown Identifier” error everytime i change the “gameobject” in the script to “suit”.
SUIT is the name of the thing i want to destroy. If i just leave the line Destroy.gameobject as gameobject, it will not be destroyed. What’s wrong?
Here’s my script. It’s in Javascript. Sorry if i did not explain right, but i am really angry right now. It’s kinda ridiculous. Oh, the pragma strict actually have a # but i had to delete it in this text bcs it would stay giant and in bold
pragma strict
var delay = 2.0; //This implies a delay of 2 seconds.
function WaitAndDestroy(){
yield WaitForSeconds(delay);
Destroy (gameobject);
}
I'm a C# dev so not sure about this but i think unknown identifier means you misspelled "suit".
– JedBeryll@Zitoox Just use it Object.Destroy(gameObject, 2.0f);
– saud_ahmed020@Zitoox var delay = 2.0; //This implies a delay of 2 seconds. function WaitAndDestroy(){ yield WaitForSeconds(delay); Destroy (gameObject); } Call this function when you want to destroy it.
– saud_ahmed020http://docs.unity3d.com/ScriptReference/Coroutine.html
– TreyH[70913-original.png|70913]It's basically this. It's in Javascript. Actually, i deleted it and rewrited so many times i don't even know if this is correct or it's wrong. There's always a problem. You know, i don't even care anymore. I am starting to think it's a VERY BIG PROBLEM WITH MY UNITY. Because this fucking engine keep saying EVERYTHING is a unknow identifier! Literally. I am still receiving the same error. [70912-daaa.png|70912]
– Zitoox