1
\$\begingroup\$

I have created a basic particle system which is a single burst around a sphere.

I have a script that disables this emission upon Start.

If I don't disable the emission, then the particles continuously emit in bursts.

However when I disable the emission, it does not completely prevent particles from being emitted. There is still a single burst at the beginning.

Here is how it looks with emission disabled:

enter image description here

Here is the script which is setting emission.enabled = false. This is attached to the sphere and the particle system is a child of the sphere.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BalloonPop : MonoBehaviour
{
    public new Renderer renderer;
    public ParticleSystem emitter;
    public float explosionTime = 0.5f;

    private ParticleSystem.EmissionModule emission;

    void Start() {
        if (!renderer) { renderer = GetComponentInChildren<Renderer>(); };
        if (!emitter) { emitter = GetComponentInChildren<ParticleSystem>(); }
        emission = emitter.emission;
        renderer.enabled = true;
        emission.enabled = false; // <===================================== this
    }
}

All I want to do right now is to make it not emit any particles at all.Then I'll add an event to re-enable the emission, but that's not the issue I'm asking about here. I also tried emitter.enableEmission = false, which is deprecated, and it didn't work.

Here is the particle system in the inspector:

enter image description here

\$\endgroup\$
2
\$\begingroup\$

The answer is that I needed to disable Play On Awake in the ParticleSettings settings.

\$\endgroup\$
  • 1
    \$\begingroup\$ You can accept your own answers for the question - make sure you give yourself props! \$\endgroup\$ – Tom 'Blue' Piddock Sep 19 '17 at 9:07
  • 1
    \$\begingroup\$ @Tom'Blue'Piddock I know, but you can't accept until 2 days later :/ \$\endgroup\$ – max pleaner Sep 19 '17 at 16:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.