Particle Emissions Stop

So I have this problem that in the middle of the game the gun particles stop appearing. I can’t figure out why this is happening since every indication is that they should be there. It happens at random with no indication that it’s connected to anything (like position of the ship or movement etc.) They will stop appearing for a while and then start appearing again inexplicably.

When I press space bar the following is true:
-Emission is checked off as active.
-The sound effect I have added to the guns plays.
-Enemies directly ahead of the guns do not die (i.e. the particles aren’t invisible or something).
-If I add a print statement to the foreach loop, it prints in the console.
-Guns are both active.
-There are no errors in the console.
-Sometimes one gun will shoot but not the other, even though they are identical except their position.

Why is this happening, has anyone experienced this before?

void ProcessFiring()
    {
        if (CrossPlatformInputManager.GetButton("Fire"))
        {
            ActivateGuns(true);
        }
        else
        {
            ActivateGuns(false);
        }
    }


    void ActivateGuns(bool isActive)
    {
        foreach (GameObject gun in guns)
        {
            var emissionModule = gun.GetComponent<ParticleSystem>().emission;
            emissionModule.enabled = isActive;
            bool gunSoundActive = gun.GetComponent<AudioSource>().isPlaying;
            if (isActive && !gunSoundActive)
            {
                gun.GetComponent<AudioSource>().Play();
            }
        }
    }
}
1 Like

I am having the exact same issue and it’s driving me nuts. I hope someone has some guidance on this…

I seemed to have resolved this issue for me. It may work for you.

In my code, I call three methods in the update:

  void Update()
    {
        if (!isDying)
        {
            ProcessFiring();
            ProcessTranslation();
            ProcessRotation();
            
        }
    }

I used to call “ProcessFiring();” at the end. Now that it’s at the start, I haven’t had this issue after running through the game three times. I used to get it 100% of the time either shortly after starting, or after just a little action with the guns.

Hope this helps!

Also, which this may not at all be related, I just updated this project to Unity 2019.0.1 after having issues with the Terrain not loading in WebGL on build. The Terrain issue was resolved. I’m not 100% sure if the particle emission issue was still happening after the update, I don’t remember to be honest.

I tried this changing the the order of the processes being called in Update, no luck I am still getting the intermittent particle emissions problems. I have heard this may be related to this specific version of Unity. Is Unity 2019 still in Beta or is it in final release?

[Solved] I updated to Unity 2018.3.6 and this problem went a way. Seems it may have just been a problem specific to that version of Unity.

1 Like

Awesome. Yeah, 2019.1.0 is still in beta. I just took caution to the wind and moved up to it. I’m glad 2018.3.6 worked!

1 Like

Hi Yitzchak,

I’m glad updating fixed the issue for you. If it had not, I would have suggested to change the Culling Mode in the Particle System Main module to “Always simulate”.

image


See also:

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms