Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by Laz0007 · Feb 16, 2019 at 03:44 PM · particlesplayemission

[Solved] Particles work only on the first time... Yes I have checked related posts... nothing works thou

I know there are other posts about this & I think I've tried them all ..... nothing works thou I just upgraded my Unity --- Unity 2018.3.5f1..... and I still have the same problem

 public class ParticleController_Player1 : MonoBehaviour
 {

     public ParticleSystem Score_Blue_Small;
     private ParticleSystem.EmissionModule Score_Blue_Small_Emission;
     //
     void Awake()
     { Score_Blue_Small_Emission = Score_Blue_Small.emission; }
     //
     void Start()
     { Score_Blue_Small_Emission.enabled = false;         
     // Score_Blue_Small.Play(); }
     //
     void Update()
     {
         if (Static_Class_Variables.Score_1Player_ParticleTrigger == true
              { RunParticale_1(); }
     }
     //
     void RunParticale_1()
     {
         Score_Blue_Small.Play();
         Score_Blue_Small_Emission.enabled = true;
         //
         // ParticleSystem Score_Blue_Small;
         // Score_Blue_Small.startLifetime = Score_Blue_Small.startLifetime;
         //
         StartCoroutine(A_letPlay_IEnum());
         //
         // All the other stuff I have tried that didn't make any differance 
         //        // Score_Blue_Small_Emission.enabled = false;
         //        // Score_Blue_Small.Clear();
         //        // Score_Blue_Small.time = 0;
         //        // Score_Blue_Small.Simulate(0.0f, true, true);
         //        // Score_Blue_Small.startLifetime = Score_Blue_Small.startLifetime;
         //        // Score_Blue_Small.emissionRate = 10;
         //        // Score_Blue_Small.enableEmission = true;
         //        // Score_Blue_Small.enable = true;
         //        // ParticleSystem.EmissionModule module_P1a = Score_Blue_Small.emission;
         //        // module_P1a.enabled = true;
     }  
     //
     IEnumerator A_letPlay_IEnum()
     {
         yield return new WaitForSeconds(4f);
         //
         Score_Blue_Small.Stop();
         //
         Score_Blue_Small_Emission.enabled = false;
     }
     //
 }

Anything else that I could try.... or any references that point to anything I haven't tried yet would be very much appreciated..... Thanks for any responses

There seems to be a trick that works for some people ..... some of the time..... lots of tricks floating around.... but I still have yet to find a trick that will (properly) work for me........ I can turn the particles on and off by enabling/disabling a parent empty gameobject.... But this looks really bad.... it just makes all the particles suddenly and abruptly disappear ( does not look good at all )

I also tried setting the particles to world space instead of local space.... but this did nothing for me either

My problem was solved...... There is a 'Stop Action' in the 'Inspector' gui ....... I had to set it to 'Callback' for my particles to repeat.......... I find it strange that absolutely nothing I have read about particles during my long struggle to get this working... even mentioned this..... maybe it just seems like such an obvious thing to someone that has done this before.... but it sure was not obvious to me... lol

alt text

a-menu3.png (19.7 kB)
a-menu3.png (19.7 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by ifurkend · Feb 16, 2019 at 05:01 PM

Don’t call Play() on Update because you’re resetting your effect on every single frame. With the effect being switched via Emission module, you only need to call Play() on Awake/Start/Enabled, thus it is unnecessary to call Stop() either when you are disabling the Emission module in the same time.

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Laz0007 · Feb 16, 2019 at 06:04 PM 0
Share

Firstly... Thanks for your response I did try this already...... it does not work for me..... I tried both in Start and Awake.... I also tried before and after the 'Particle.enabled = false;' line.... and yes...... I didn't use play again ... only the 'Particle.enabled = false; /or/ Particle.enabled = true;' afterward ........... Nothing happens at all.... no particle plays ever.... not even the one time.... this is that I tried this time.....

 public class ParticleController_Player1 : $$anonymous$$onoBehaviour
 {

     public ParticleSystem Score_Blue_Small;
     private ParticleSystem.Emission$$anonymous$$odule Score_Blue_Small_Emission;
     //
     void Awake()
     {
       Score_Blue_Small_Emission = Score_Blue_Small.emission;
       //Score_Blue_Small.Play();
     }
     //
     void Start()
     {
         Score_Blue_Small_Emission.enabled = false;
         Score_Blue_Small.Play();
         // Score_Blue_Small_Emission.enabled = false;
     }
     //
     void Update()
     {
         if (Static_Class_Variables.Score_1Player_ParticleTrigger == true)
         {
             RunParticale_1();
         }
     }
     //
     void RunParticale_1()
     {
         //Score_Blue_Small.Play();
         Score_Blue_Small_Emission.enabled = true;          
         //
         StartCoroutine(A_letPlay_IEnum());
     }
     //
     IEnumerator A_letPlay_IEnum()
     {
         yield return new WaitForSeconds(4f);
         //
         //Score_Blue_Small.Stop();
         //
         Score_Blue_Small_Emission.enabled = false;
     }
     //
 }

Any other suggestions? ........... I'm all out of ideas/suggestions to try

avatar image ifurkend Laz0007 · Feb 17, 2019 at 01:14 AM 0
Share

I do not entirely understand your circumstances. If Score_1Player_ParticleTrigger remains true after the effect is done playing, the effect will repeat itself until the var becomes false, but ParticleSystem.isPlaying is the easiest answer for you, even though I personally would avoid it at all cost:

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
 public class ParticleController_Player1 : $$anonymous$$onoBehaviour
  {
      public ParticleSystem Score_Blue_Small;
      
      void Update()
      {
          if (Static_Class_Variables.Score_1Player_ParticleTrigger == true && Score_Blue_Small.isPlaying == false)
          {
              Score_Blue_Small.Play();
              StartCoroutine("A_letPlay_IEnum");
          }
      }
      
      IEnumerator A_letPlay_IEnum()
      {
          yield return new WaitForSeconds(4f);
          Score_Blue_Small.Stop();
      }
  }

avatar image Laz0007 · Feb 17, 2019 at 08:11 AM 0
Share

I wanted to say thank you for your response...... I did try your suggestion early on... but abandoned it because it didn't work.... I have tried so many things since then..... because of your response I revisited doing it that way again..... and because of that, I did find the answer.... It was the setting in the 'Inspector' gui..... in the particle system there is a setting named 'Stop Action' ...... once I set this to 'Callback' everything worked like a charm ^_^............ I really want to say thanks again for your response..... because I don't think I would have revisited doing it that way again.... or ever found the answer...... cheers alt text

a-menu3.png (19.7 kB)

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

170 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Checking total number of particles in a scene 1 Answer

Emitting water 0 Answers

Tanks Tutorial - dust trails not emitted on MovePosition 4 Answers

Low particle emission rate 1 Answer

Can't find a way to add particle effects to a collision 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges