Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 /
avatar image
1
Question by minoroptions · Aug 12, 2013 at 05:28 PM · particlesparticleemitter

ParticleSystem.Play() does not play particle.

So, I have a Shuriken particle that works fine when I clicked "Simulate" button during the edit time. However, when I try to play this particle using "particleSystemComponent.Play()" via a c# code, it does not emit any particle. Using a debug log, I found out that

  • particleSystemComponent.time is always at zero.

  • particleSystemComponent.particleCount is zero. (So, yeah, it did not emit any particle after Play() is called)

  • particleSystemComponent.isPlayed is true. (It is playing but the time is always at zero...why?)

Nevertheless, if I use "particleSystemComponent.Emit(1)" instead of "particleSystemComponent.Play()", a single particle will be emitted and the time will start running until the particle ends and the time will stop again. However, "Emit(1)" is not a proper way to spawn particle since it will not spawn a correct series of particle. Is there any solution to make the "Play()" method working? Thank you for your suggestion.

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

10 Replies

· Add your reply
  • Sort: 
avatar image
19
Best Answer

Answer by TB_BSG · Jul 03, 2014 at 12:56 PM

Had a similar problem. I think the problem is if you ever call Play() or Stop() without checking if it is playing already.

 pS.Play();
 ...
 pS.Stop();
 ...
 pS.Stop();
 ...
 pS.Play();

Caused the particle system to start running again but not emitting particles if for some reasone. With ... I mean that other code was executed and the functions where called in different updates!! The following code does restart the emission

 if(!pS.isPlaying) pS.Play();
 ...
 if(pS.isPlaying) pS.Stop();
 ...
 if(pS.isPlaying) pS.Stop();
 ...
 if(!pS.isPlaying) pS.Play();


Comment
Add comment · Show 6 · 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 jamius19 · Dec 10, 2015 at 05:43 PM 0
Share

its the real cause :D saved me a lot of headache :D thanks buddy :D

avatar image P0lT10n · Apr 06, 2016 at 05:39 PM 0
Share

It did not work for me... I had to do the GameObject setactive thing...

avatar image legionair4 · Jun 23, 2020 at 04:06 AM 0
Share

I have been trying to figure this out for half a day. You sir are my hero.

avatar image SpruceMooseGames · Aug 12, 2020 at 10:12 AM 0
Share

Second time this has happened to me in three months, should have learnt my lesson the first time around! Always check the animation is stopped first

avatar image LoboBobo123 · Nov 13, 2020 at 11:46 PM 0
Share

6 years later, you saved me. Thank you so much!!!

Show more comments
avatar image
11

Answer by oinkoinkflapflap · Aug 05, 2014 at 12:11 PM

Almost a year old this post i know, but I had the same thing. I couldn't work out why it wouldn't emit, the only way i could make it work was just to have PlayOnStart checked, and the object inactive, then set active later (particleSystemObject.SetActive(true);) and it works fine:

Hope this helps, sorry for the years wait ;)

Comment
Add comment · Show 7 · 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 Zynigma · Dec 14, 2014 at 12:19 AM 1
Share

Thank you, @oinkoinkflapflap. I had a particle system the wouldn't play from just particleSystem.Play(), so I set it to Play On Awake, turn it off in the scene, and just fire particleSystem.gameObject.SetActive(true); when I want to play the particle system.

avatar image NewPath · Jun 30, 2015 at 11:50 AM 0
Share

Same for me, this was the only way I could get it to work.

avatar image jacupiri · Mar 13, 2016 at 10:38 PM 0
Share

Bizarre! It also happened to me! Lost a lot of time trying to understand why the dammed Play() function did not work!

Hope they solve this bug soon!

avatar image Psyco92 · Mar 28, 2016 at 07:56 PM 0
Share

Still useful in 2016. thanks man

avatar image mandinga90 · Mar 11, 2018 at 11:00 PM 0
Share

Actually, I got a much better result using SetActive(false) and SetActive(true), too. You'll see that it's much faster in reaction and works fluently! ;)

avatar image Kerihobo mandinga90 · Mar 12, 2018 at 04:53 AM 0
Share

The problem with SetActive is 'popping'. We usually want to ease our effects in and out over time, gradually. SetActive is too sudden.

Show more comments
avatar image
2

Answer by SanX91 · Aug 13, 2013 at 11:29 AM

just make a particle system, as u want.... then through code ....

Example : -

void Start() {

  ParticleSystem pS = GetComponent<ParticleSystem>();

  pS.enableEmission = true;

}

Attach this code to the particle system....

Comment
Add comment · 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
2

Answer by Kerihobo · Aug 18, 2015 at 10:37 AM

i had the same problem. What was more confusing is that the particle system that wasn't working was duplicated from one that WAS working. I logged .isPlaying before/after .Play().

it logged false. it logged true.

Yet it wouldn't render, no idea why. Anyway, i moved it's place in the hierarchy, then moved it back again... suddenly it worked fine.

Comment
Add comment · 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
2

Answer by KarlKarl2000 · Mar 14, 2018 at 02:52 AM

Thank goodness for the forums, the documentation is lacking sometimes.

I did similar what was done here, but more brute forced.

            void Start () 
            { 
                _particle00 = GetComponent<ParticleSystem>();
            }

            void SFX ()
            {
                 _particle00.Stop();
                 _particle00.Play();
            }

Hope this helps someone out there.

Sharin' is carin'

@indiedoroid

Comment
Add comment · 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
  • 1
  • 2
  • ›

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

38 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

Related Questions

Particle delay 1 Answer

Particles do not appear on play but do on emit 0 Answers

Particle Emitter Breaks in emission. Help? 1 Answer

How to make windswept snow on mountains? 0 Answers

Scale Shuriken Particle System with Parent Transform 5 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