Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

How to play partical effects using script?

Discussion in '2D' started by Nittrix, Jun 11, 2022.

Thread Status:
Not open for further replies.
  1. Nittrix

    Nittrix

    Joined:
    May 1, 2022
    Posts:
    2
    Hello, I'm new to unity and I'm trying to add some particle effects when the player dies, I'm able to play the effect but the particle keeps looping, to play the effect I simply have a variable for my effect:


    "public ParticleSystem explosion;"

    and I play the effect using:

    "explosion.Play();"

    How do I fix this problem, tell me if you need more info on the script, and yes my particle effect does not have the looping property on.
     
  2. Nittrix

    Nittrix

    Joined:
    May 1, 2022
    Posts:
    2
    I resolved the issue, for anyone wondering I just used a IEnumerator to do:
    "explosion.Stop();"
    witch stopped the explosion.
     
  3. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    10,620
    Can you please ask on the scripting forum in the future as this is the 2D forum and as such has nothing to do with the particle system or generic scripting issues.

    Thanks.
     
Thread Status:
Not open for further replies.