when I try to use this code (from the scripting reference)
using UnityEngine;
public class AutoDestructParticleSystem : MonoBehaviour
{
void LateUpdate ()
{
if (!particleSystem.IsAlive())
{
Object.Destroy (this.gameObject);
}
}
}
I get this error in unity 3.5Beta
Does anyone know what is going on?
No one else has had the need to do this? Really?
In Javascript:
#pragma strict
function Start () {
}
function Update () {
if (!particleSystem.IsAlive()){
Destroy (this.gameObject);
}
}
I new at this game dev/coding stuff so I’m not sure if this is elegant, but it this works for me! And yeah, I’ve been searching for an “Autodestruct” type thing for the particles in Unity 3.5 for the past hour…
Anyways, hopefully this helps!
this is what i get with your script
Are you using the release version or the beta?
As the new particle system was added with 3.5 I would suspect that the particle system api changed seriously during the beta and your version might simply not support it yet
Just saw that, I was running 3.5.0b6, it did not see 3.5.0f as a newer version, updating now. Thanks for the help.