Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 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 /
  • Help Room /
avatar image
0
Question by Madchazzer · Dec 01, 2018 at 06:30 AM · particle systemparticle emitterparticleeffect

Particle Effect to disable after it's played once

I've been trying to get this particle effect attached to a 2D object to play when the object is destroyed or hit by another object and then disappear after it's played once, I've managed to get it to play with the collision, however it won't stop playing after the object is destroyed. The particle effect is attached to the game object as a child, and I have it running over several scripts, a spawner script and the particle effect script. The Game object has the particle effect script attached with the particle effect attached to that, along with the spawner script attached to the game object with the particle effect attached to that. I've unticked looping on the particle effect and I have run out of ideas. If anyone is able to help out I would greatly appreciate it.

Spawner Script

 public GameObject prefabToSpawn;
     public float adjustmentAngle = 0.0f;
 
     public void Spawn()
     {
         Vector3 rotationinDegrees = transform.eulerAngles;
         rotationinDegrees.z += adjustmentAngle;
 
         Quaternion rotationInRadians = Quaternion.Euler(rotationinDegrees);
 
         Instantiate(prefabToSpawn, transform.position, rotationInRadians);
     }

Particle Effect Script

 public ParticleSystem Explosion;
     void Start()
     {
         //Disables the particle effect
         Explosion.GetComponent<ParticleSystem>().enableEmission = false;
     }
 
     private void OnTriggerEnter2D(Collider2D collision)
     {
         // When the collision has been recognised plays particle effect
         Explosion.GetComponent<ParticleSystem>().enableEmission = true;
         Explosion.GetComponent<ParticleSystem>().Play();
         StartCoroutine(StopExplosion());
     }
 
     IEnumerator StopExplosion()
     {
         // Stops particle effect
         yield return new WaitForSeconds(.1f);
         Explosion.GetComponent<ParticleSystem>().enableEmission = false;
     }

Comment
Add comment · Show 2
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 ifurkend · Dec 01, 2018 at 06:40 AM 0
Share

Uncheck “looping” in the particle system, including all child particle systems, set proper duration if it’s too short or too long.

avatar image bubsoxs · May 05, 2019 at 09:08 AM 0
Share

Have you figured this out? I am working on a similar issue.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Madchazzer · May 05, 2019 at 11:30 AM

@bubsoxs sorry but apparently the only thing wrong I had was what @ifurkend pointed out, the looping check box, which I thought I had already unchecked. Sorry I couldn't be any more help. Sorry I didn't say thanks sooner ifurkend, so thanks.

Comment
Add comment · Show 2 · 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 bubsoxs · May 05, 2019 at 05:03 PM 0
Share

I'm getting enableemission = false is showing obsolete error. I'm using unity 2018 for this project. Also do I need to turn off emissions and turn off start awake in the inspector? I have fireball particle effect that when collides with a target it will trigger the explosion particle effect using ontriggerenter2d. I am using boxcollider2d. The explosion effect is a child of the fireball. I am relatively new to unity so any suggestions would be great. I been searching this topic for a few days now and I am stuck...

avatar image ifurkend bubsoxs · May 05, 2019 at 10:32 PM 0
Share

Unity has long changed the way to script with Particle System:

https://blogs.unity3d.com/2016/04/20/particle-system-modules-faq/

In short, if you're merely reading the value, you can simply do this:

 float _rateOverTime = _particleSystem.emission.rateOverTime$$anonymous$$ultiplier;

But if you're to change the value, you must cache the module class of the target value to a variable first:

 var _psm_emission = _particleSystem.emission;
 _psm_emission.rateOverTime$$anonymous$$ultiplier = _someFloatValue;


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

164 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

Related Questions

Particles Instantiate doesnt show up (Hidden behind background image) 0 Answers

How to make Particle System on when I throw grenades on ground after 5 second. 3 Answers

Sub emitters: Start Delay & Burst Cycles do not work 0 Answers

Problem with Particles and Particle System 1 Answer

How can you create non circular rocket flame particle effect? 0 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