• 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
0
Question by OtreX · Feb 23, 2016 at 10:12 AM · particlessetactivepoolexplosions

Turning on and off Particle effects

Hi. I'm trying to do something that IDK if its possible. I'm working on a 3d space shooter and I have explosion particle effects. I followed some youtube tutorials as I'm no expert with particle effects and something that I found out is that everybody creates a prefab and instantiates a gameObject Explosion when needed and when the effect is done, they destroy that gameObject Explosion.

I tried to instantiate them on start and have them inactive, so basically have a pool to pull from and turn on every time I need one. When I need one I turn it on, I see the particle effect and turn off the effect and it works ONLY the first time. When I turn on a gameObject Explosion that I already used, its like the particle effect is already spent. Is there a way in which I can reset the particle effect so I can use it again?

If there is a script for that or an explanation, try to keep it in C# please as that is the language I'm using, but if you already have it in javascript, feel free to post as well.

Thank you for your time.

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 OtreX · Mar 17, 2016 at 03:11 PM 0
Share

@rajavamsidhar_gvs sorry for the late reply (i thought i already had replied). thank you, that was exactly what i was looking for.

avatar image rajavamsidhar_gvs OtreX · Mar 19, 2016 at 10:09 AM 0
Share

its ok.if it works vote up and accept as answer

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by rajavamsidhar_gvs · Feb 23, 2016 at 10:58 AM

hi..you can try this.i didnt tested.once check it and let me know result.

 public GameObject particlePrefab;//drop your particle effect prefab here
 public GameObject bulletout;//drop your bullet out object
 void Start()
 {
 particlePrefab.setActive(false);
 }
 void Update()
 {
 if(input.GetMouseDown(0))
 {
 GameObject Bullet=Instantiate(particlePrafab,bulletout.transform.position,bulletout.transform.rotation)as GameObject;
 Bullet.setActive(true);
 Bullet.GetComponent<ParticleSystem>().Play();
 
 }
 }

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Recycling particle system 1 Answer

Code to turn off ParticleSystem doesn't turn it off in-game, but instead turns it off on the prefab permanently? 0 Answers

physics.OverlapSphere colliders 1 Answer

Recycling particle emitter leaves particles in 2 locations instead of 1 3 Answers

Agent killing and respanwning 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