- Home /
Switch Out Particle Systems
Hi, all!
Working with the Legacy Particle Systems, is there a way I can switch out different particle systems on one object? The reason I ask this is because Legacy systems are broken up into 3 parts. Plus, I can't save JUST a particle system as a prefab.
Really, I just want to change the particle Animators, but that isn't working either.
Any tips?
Thanks! - YA
Tried this to no avail:
#pragma strict
@HideInInspector
var myPar : ParticleAnimator;
var anim1 : Transform;
var anim2 : Transform;
var anim3 : Transform;
var anim4 : Transform;
@HideInInspector
var par1 : ParticleAnimator;
@HideInInspector
var par2 : ParticleAnimator;
@HideInInspector
var par3 : ParticleAnimator;
@HideInInspector
var par4 : ParticleAnimator;
function Start () {
myPar = GetComponent( ParticleAnimator );
par1 = anim1.GetComponent( ParticleAnimator );
par2 = anim2.GetComponent( ParticleAnimator );
par3 = anim3.GetComponent( ParticleAnimator );
par4 = anim4.GetComponent( ParticleAnimator );
myPar = par4;
}
Where the anim_x's are the prefabs.
I just don't understand how I could switch out one part of a Legacy system with another
Answer by Negagames · Apr 27, 2013 at 03:23 AM
You never specified if you wanted it to "lerp" into the next legacy particle system. But if you just want it to switch, simply attach your particle systems to empty gameOjbects THEN save them as prefabs and use
var particle1 : Transform;
var particle2 : Transform;
Destroy(particle1);
var nextParticle : Transform = Instantiate(particle2, transform.position, Quaternion.identity);
nextParticle.parent = transform;
to add in the next particle system and make it a child object.
Seems straightforward. Thanks for the advice! I was trying to switch out components when the real strategy is to switch out entire objects. thanks for the help! - YA
Your answer
![](https://koobas.hobune.stream/wayback/20220613101019im_/https://answers.unity.com/themes/thub/images/avi.jpg)