Hi, After I update to Unity 5.3.1f1 from 5.2.3f1 my particle systems don't play: they play in Editor Simulation Mode, and they play in game if I use Play On Awake. In my script I use next code, initialization: Code (CSharp): _collisionParticles = transform.parent.FindChild("PlayerCollisionParticles").GetComponent<ParticleSystem>(); To play I use this code: Code (CSharp): _collisionParticles.Play(); And to stop: Code (CSharp): _collisionParticles.Stop(); Also, while I log _collisionParticles.isPlaying before and after I notice, after Play() it logs true, but after Stop() it remains true - and in both states I don't see any emission.
I made a test (zip in attach): I create new project in Unity 5.3, create default particle system and try to Play it via script - nothing happened. Could someone download project and try to reproduce problem? I thought, the problem in project upgrade from old format to new, but it looks like this is a permanent bug... I cannot google any similar problems with particles in 5.3, so it looks like only I have this problem.
I was able to reproduce the problem (Unity 5.3.1p1). The odd thing is, if you call particlePlayInvoke() from Start() directly (not using Invoke) particles start playing. I thought maybe it's related to Invoke() and replaced it with a coroutine, but it has the same issue. So, my second thought would be it's not related to Invoke, but more an issue with ParticleSystem itself. As far as I know, they changed a lot of the particle system code in 5.3 and changes often come with new issues. I'd submit the test project you have as bug-report, along with a nice how to reproduce list/description.
Same issue here. A dirty workaround to change "sumulation space" to "world". This will allow to play particle system from script and from editor.
Same here been having alot of issues with trying to manage my texture sheet particles. For me they seems to be stuck playing reported by debug.log, and I have to launch Stop() multiple times to make it stop. A work around was to add into method that plays the system a little simulation code. public void PlayParticles(int i) { pSys.Simulate(1); pSys.Play(); } guh seems really dirty I know but it works using 5.3.1p1
Happening to me as well. I was able to fix it by disabling then re-enabling the gameobjects via script to re-start them. It's probably a bug left over from this one: http://issuetracker.unity3d.com/issues/particles-invalid-aabb-slash-infinite-errors-in-5-dot-3-1 I've reported the issue to the Unity tracker. In the future, everyone else should do that as well right away to get it noticed.
Hi, I have the exact same issue. I call play() and stop() and nothing happens, but if I set the particle system to play on awake it runs fine. This is very frustrating. I hope this issue is fixed soon. Edit: Sometimes the particle system plays, but only sometimes. Edit 2: IsAlive seems to not work either.
Make sure to report an official bug by making a demo in a fresh project and with the project opened, using the Help > Report a Bug... menu action.
I already made bug report (Case 757461 ParticleSystem doesn't play), QA team say when they decide in which version they fix it they write to me back.
I found out something very interesting: the particle system plays correctly if you add an empty subemitter. Which brings me to the following topic, because I tried to add a subemitter through code: you can not change the parameters of the partcle system at runtime. For example, the EmissionModule struct is exposed as property. Because a struct getter returns a value and not a reference, C# does not allow you to change the parameters directly, only through getting, changing and setting again. However, there is no public setter... UPDATE: it works even if you just enable the subemitter module, no need to add an empty subemitter.
Yes it will make things run again, but with subemitter enabled, automatic culling is off. Which defeats the purpose of pooling the particle system since I use pooling to improve runtime performance. If I am going to do that might as well just instantiate on use and destroy afterwards. I cannot believe such a critical function broken and they did not instant hot fix this thing.
Just to let you know that I posted a bug report about isPlaying() and isAlive() not working as it should. Got a reply that it was fixed in 5.4.
I got e-mail from Unity's QA: "We have fixed this and problem should not appear in the upcoming patch release (5.3.2p1)"
I'm on 5.3.2p2 and i'm still having a ton of issues just getting particle systems to play. Why is this so difficult, they've been broken forever.
I wish I would have read this an hour ago - would have saved me a lot of sanity. Thanks a lot for the dirty fix.
Yes, the dirty fix works. but I get a ton of errors now (that do not interupt play in editor tho)..... At Play()...
They'll fix it eventually I hope. Didn't run into those errors while testing myself. Are you confident it's due to the particles?
Did they fix this? Should I update unity (I want to work on my project and don't want to have to redownload unity unless this is working)
This is still in issue in 5.5.2. I am having to use Simulate(1) before the Play() as mentioned above otherwise no particle effect appears.
Emit() does not work properly either in 5.6.0.f3. When Simulation Space is set to Local, it works the first time Emit() is called. However, it stops working for the consecutive calls. Once Simulation Space is set to World, it works every time.
.Play() does work if prewarm is not true.. I have a particle system in my game and prewarm is off and my code works fine.. Code (CSharp): ParticleSystem dust; public GameObject _particleHolder; void Start () { dust = _particleHolder.GetComponent<ParticleSystem>(); } /// In one of my methods i call _particleHolder.GetComponent<ParticleSystem>().Play(); then Stop in another .. Code (CSharp): _particleHolder.GetComponent<ParticleSystem>().Stop();
@litebox here you go.. Not tested but in theory it should work Code (CSharp): using UnityEngine; using System.Collections; public class ParticlesTest : MonoBehaviour { private ParticleSystem _collisionParticles; // Use this for initialization void Start() { _collisionParticles = GetComponent<ParticleSystem>(); Debug.Log("Start"); Invoke("particlePlayInvoke", 2.5f); } private void particlePlayInvoke() { Debug.Log("_collisionParticles.isPlaying before: " + _collisionParticles.isPlaying); _collisionParticles.GetComponent<ParticleSystem>().Play(); Debug.Log("_collisionParticles.isPlaying after: " + _collisionParticles.isPlaying); } // Update is called once per frame void Update() { } } or if its atatched to an empty gameobject like mine is.. Code (CSharp): using UnityEngine; using System.Collections; public class ParticlesTest : MonoBehaviour { ParticleSystem _collisionParticles; public GameObject _particleHolder; // Use this for initialization void Start() { _collisionParticles = _particleHolder.GetComponent<ParticleSystem>(); Debug.Log("Start"); Invoke("particlePlayInvoke", 2.5f); } private void particlePlayInvoke() { Debug.Log("_particleHolder.isPlaying before: " + _particleHolder.isPlaying); _particleHolder.GetComponent<ParticleSystem>().Play(); Debug.Log("_particleHolder.isPlaying after: " + _particleHolder.isPlaying); } // Update is called once per frame void Update() { } }
I found the solution, and it's to simply change particle system name in script and then put it in inspector once again. Maybe it helped only me but maybe it's global solution
Code (CSharp): ps.Simulate(1,false,false); ps.Play(); I did it and it works, but only the parent and the children have no reaction. Anyone can help?
I came across the same issue and solved it by querying the game object directly. Code (CSharp): var holder = GameObject.Find("ParticleSpawn"); var particle = holder.GetComponentInChildren<ParticleSystem>(); particle.Play();
Same issue on 2018.3.02f, my particle system doesn't play at all. "Play On Awake" has been checked, when I run the game, the particle system is still not emitting. I noticed that when I turned to scene view while still running the game, the particle started to emit. It looked like something were being updated when I took a look at the scene view. In my case, particle.Play() doesn't even work.
Can confirm. Something's bugged. Play On Awake is checked. Prefab with ParticleSystem in question is alone in the scene. Calling Play(true) from script in either Awake(), Start(), OnEnable() or any other sort of remotely called (f.e. Setup()) method doesn't start it. Setting Simulation Space to World doesn't start it. It only starts once the GO has been disabled and reenabled at least once or when I switch from Game to Scene view and back. Also. ParticleSystems on a prefab that aren't set to PlayOnAwake DO for some reason play on awake once at game start.
Had this bug on a Prefab with several Particle Systems in Unity 2018.3.2f1. playOnAwake was set to true and I tried many of the suggestions in this thread but only switching to the "Scene" tab was starting them. I eventually found that setting their Culling Mode to Always Simulate worked. Since the Particle Systems were outside of the Scene it makes sense but shouldn't Culling Mode: Automatic figure things out? This is probably bad in terms of performance!
Unity 2018.3.0f2 and the problem still there. used this code at Start() to solve: ParticleSystem ps = GetComponent<ParticleSystem>(); ps.enableEmission = true; ps.Simulate(1); ps.Play();
Unity 2020.1.2f1 Slightly tweaked code from @diegodimap above, still works as workaround. (Culling mode automatic, play on awake false, prewarm false). Code (CSharp): ps.Simulate(0.1f); // Hack to workaround Unity bug that wont play the particles. ps.Play(true); // True to play the children as well.
Hm in my case ParticleSystem attached to the prefab for some reason did not play after object is being created. But in debugger it shows the object created and reference to my ParticleSystem. That how I've fixed it without using Simulate: Added to Start: Code (CSharp): explosionParticle = FindObjectOfType<ParticleSystem>(); Now it works without issue
I had the same issue. my problem was that I assigned the particle from the project folder rather than the particle in the hierarchy. Then you can just use nameOfParticle.Play();