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
4
Question by gegc · Aug 29, 2012 at 10:11 PM · particlesparticlesystemparticleshuriken

Resetting non-looping particle system

I have a gun that shoots GameObjects (non-hitscan bullets). I'm precaching all the bullets (the gun has a maximum range, so I just instantiate as many bullets as it can possibly fire at once), and want to do the same with the bullets' fancy particle impact effects. Each impact effect is a non-looping particle system, which refuses to play more than once regardless of what I do. I've tried activating/deactivating the gameObject it's attached to, setting enableEmission=true/false, and setting particleSystem.time back to 0 (and various combinations of the three). Nothing seems to work. I don't want to loop the particle systems because that creates weird effects and makes more work for my artist (who would have to remember the lifetimes of the particleSystems and enter them manually into the precache manager component).

tl;dr: How to make a loop=false particle system reset and play more than once.

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

5 Replies

· Add your reply
  • Sort: 
avatar image
9

Answer by dreasgrech · Jul 24, 2014 at 11:24 PM

Call particleSystem.Clear() to reset your particle system, and then particleSystem.Play() to play it again.

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 Calos1591 · Jul 30, 2016 at 10:06 PM

GameObject_ParticleSystem.SetActive(false); GameObject_ParticleSystem.SetActive(true);

Works for me Unity 5.3.2

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
0

Answer by JonnyHilly · Aug 30, 2012 at 07:07 AM

particleEmitter.emit = true;

particleEmitter.Emit();

particleEmitter.emit = false;

:)

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
0

Answer by alternative_richie · Dec 22, 2015 at 11:10 AM

The above answers didn't work for me so I used this to restart it :-

http://docs.unity3d.com/ScriptReference/ParticleSystem.Simulate.html

ParticleSystem.Simulate(0.0f,true,true);

Previously I had done it by using SetActive(false) on the GameObject when the particle finished playing and then SetActive(true) when I wanted to play it again. This worked and restarted the particle. But I thought this was inefficient so am now using emission.enabled true and false and Simulate to restart it, keeping the GameObject itself active.

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
0

Answer by Hrusilov · Feb 10, 2016 at 05:39 PM

I wanted to emit some particles for shooting and had to do this:

 GetComponent<ParticleSystem>().Clear();
 GetComponent<ParticleSystem>().Simulate(GetComponent<ParticleSystem>().duration);
 GetComponent<ParticleSystem>().Play();

I have the shooting script attached to the same game object as 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

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

12 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

Related Questions

Changing startRotation from ParticleSystem on script does not work 1 Answer

How to destroy live particle in Shuriken 1 Answer

Scale Shuriken Particle System with Parent Transform 5 Answers

Shuriken particle System - change velocity by trigger 0 Answers

Tutorial for Jean Moreno's Cartoon FX?? 1 Answer


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