Hello,
I’m using a decal system like this
var rot = Quaternion.FromToRotation(Vector3, hit.normal);
if (hit.transform.tag == “Target”){ //
if (sparksPrefab) Instantiate(sparksPrefab, hit.point, rot);
hit.transform.SendMessage(“ApplyDamage”, 5, SendMessageOptions.DontRequireReceiver); // and consume its health
}
How would I make the particles delete themselves shortly after they are created?
Thanks!
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 ...