var burstEnergy : float = 10.0;
var explosionObject : Transform;
function LateUpdate() {
var theParticles = GetComponent ParticleEmitter.particles;
var liveParticles = new int[theParticles.length];
var particlesToKeep = 0;
for (var i = 0; i < ParticleEmitter.particleCount; i++ )
{
if (theParticles*.energy > burstEnergy)*
-
{*
_ theParticles*.color = Color.yellow;_
_ // We have so much energy, we must go boom*_
* if (explosionObject)*
* Transform.Instantiate(explosionObject,*
_ theParticles*.position,
Quaternion.identity );
} else {
liveParticles[particlesToKeep++] = i;
}
}
// Copy the ones we keep to a new array*
* var keepParticles = new Particle[particlesToKeep];
for (var j = 0; j < particlesToKeep; j++)
keepParticles[j] = theParticles[liveParticles[j]];
// And write changes back*
* particleEmitter.particles = keepParticles;
} *
ERROR:
Error UCE0001: β;β expected. Insert a semicolon at the end. (UCE0001) (Assembly-UnityScript) on: βvar theParticles = GetComponent ParticleEmitter.particles;β_