Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 Ozy · Mar 08, 2011 at 05:05 PM · particlesdestroyprefabstimer

Making a cloned particle emitter fire once only

Alright, well, I have this particle emitter prefab seperate from the gun enitity,

var Poof : Transform;

function OnCollisionEnter( ){

var clone : Transform;
clone = Instantiate(Poof, transform.position, transform.rotation);
 Destroy(clone, 0.5) ;

}

However I want the cloned prefab to disappear after a set amount of time.

For now, it just continually repeats.

The script clones the prefab and I want the cloned prefab particle emitter to be destroyed after it runs it's 1 second course.

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

2 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by Justin Warner · Mar 08, 2011 at 05:35 PM

On the particle prefab, their is a thing called Autodestruct, which'll make it destroy itself once it does the full animation.And then put on One Shot, and it'll do it right.

Alternatively, you could do the yield WaitForSeconds (Check API).

Hope this helps! Any questions, ask =).

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 Ozy · Mar 08, 2011 at 06:30 PM 0
Share

But that destroys the actual prefab, I want the clone of the prefab to disappear after a set amount of time after the impact. I tried the autodestruct and that destroys the parent prefab, rendering the clone spawning useless.

avatar image Justin Warner · Mar 08, 2011 at 11:20 PM 0
Share

Oh, I had this problem before... $$anonymous$$ake a copy below the map, then copy from there? Or you can just enable it and disable it, or move it under the ground after it shoots. Or you can disable the autodestruct, and try that?

avatar image
0

Answer by PrimeDerektive · May 13, 2011 at 02:46 PM

Instantiating one-shot particle emitters that self-destruct is generally a bad idea, because its going to result in a lot of unnecessary drawcalls.

It's better to make your particle system a one-shot system that is set to not emit at all by default (or by setting .emit to false in Start()) and hiding it somewhere in the scene, and then positioning and rotating the emitter at the point of impact you want the effect to be, then calling the particleEmitter.Emit() function (which will make it emit once).

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

No one has followed this question yet.

Related Questions

Trying to destroy a projectile and "teleport" to another area of the screen when it hits a target. 1 Answer

How to destroy an instantiated prefab in C#? 4 Answers

Audio and Particles on Trigger 0 Answers

Blocking particles then destroy then reduce health 0 Answers

Help me to manage game memory 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