Behaviour of SetActive seems to have changed. Re-firing effects now interrupts itself, breaks my effect system.

Ok, first let me define what I mean by effects. For my purposes, an effect is a gameObject which is the parent of other objects, usually some particle emitters and an audio source.

I built an effect system that instantiates one instance of each effect I will need from a public array of GameObjects at level start (in the Awake() function). In gameplay, I simply make a calls to my effect manager to move the desired effect to the desired location and “fire” it, giving me sound and particles as desired… well… until today. Since today, firing an effect again, causes any remaining particles to disappear before the effect fires again. The old behaviour used to be that particles that had already been emitted would stick around to their death unless I failed to allocate enough particles to the effect.

Please note that I have NOT touched this code at all in MONTHS. The only thing that has happened between these two builds was upgrading from 4.5.2 to 4.5.3. However, I’m pretty sure I built the version that’s currently on my iPod using 4.5.3 and it does NOT show the new issue. Also, I’ve been using 4.5.3 since its release but have only now noticed the problem.

Here is what the code that “fires” the effects looks like: (note:I set the object to inactive then active on the same frame to achieve this)

public function PlayEffectAtLocation(effectName : String, effectPosition : Vector3, effectRotation : Quaternion)
{	
	var i : int = effectsDictionary[effectName];

	effects*.transform.position = effectPosition; //set effect position*

_ effects*.transform.rotation = effectRotation; //set effect rotation*_
_ effects*.gameObject.SetActive(false); //ensure effect is inactive*
effects*.gameObject.SetActive(true); //activate effect*
}_

[1]: http://www.northernbytes.ca/unity/Top_Down_Platformer_OLD/Top_Down_Platformer.html
[2]: http://www.northernbytes.ca/unity/Top_Down_Platformer/Top_Down_Platformer.html

This v4.5.3 release note probably has something to do with your issue:

Shuriken: Fix for re-enabled particle system which was disabled before it has finished.

My suggestion would be to do a gameObject.GetComponent.Play() instead of relying on the playOnAwake flag.

If you have multiple particle systems you can always iterate through them using something like this:

foreach( var ps in gameObject.GetComponentsInChildren<ParticleSystem>() )
  ps.Play();