- Home /
Question by
twoface262 · Jan 10, 2012 at 06:59 AM ·
particlesdeletedecal
Deleting decals
Hello, I'm using a decal system like this
if (hit.transform.tag == "Target"){ // if (sparksPrefab) Instantiate(sparksPrefab, hit.point, rot); hit.transform.SendMessage("ApplyDamage", 5, SendMessageOptions.DontRequireReceiver); // and consume its healthvar rot = Quaternion.FromToRotation(Vector3, hit.normal);
} How would I make the particles delete themselves shortly after they are created? Thanks!
Comment
Best Answer
Answer by Lo0NuhtiK · Jan 10, 2012 at 07:45 AM
Just destroy the clones ->
var sparksPrefab : WhateverYouHaveHere ;
//!!->
var destroyCloneInSeconds : float = 1.30349859 ; //whatever seconds
function Whatever(){
var rot = Quaternion.YattaYattaYatta ;
if(hit.tag.yatta){
//!!->
var clone : WhateverYourSparksPrefabHasUpThere ;
if(sparksPrefab!=null){
//!!!!!!!!-->
clone = Instantiate(sparksPrefab, hit.point, rot) ;
}
hit.transform.sendMessage(whatever) ;
//!!-->
Destroy(clone.gameObject, destroyCloneInSeconds) ;
}
}
lol... that looks horrible ...