• 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 Rickstrife · Oct 24, 2013 at 08:34 AM · c#particle systemparticle

How to Destroy A single Particle

alt text hopefully this picture helps give you a visual of what am trying to do

currently I have a game object with a sphere collider as a trigger and a particle system (Shuriken)

I then add another script that must remove particles as they exit the trigger. Am having a hard time figuring out how to do this with any particle that exits the sphere to remove from the array list of that particular particle system

I know I must somehow use functions GetParticles , and SetParticles to do this Any clues or help would be very much appreciated

I think I need to -Grab access the array of the particle system -find the correct particle that exited -delete it -set the new array back without the deleted particle

My questions are -how do I know which particle that left what index -how to remove the particular particle -and set the correct particle array back

this is what i currently have that am using to get a deeper understanding on how to access all the info i need to achieve what i want.

public class BlastRadius : MonoBehaviour {

 Particle [] particleArray;
 int particleCount;
 
 

 void Start () {
     particleArray = new Particle[particleCount];
 }
 
 // using to understand how info is stored within the particle system
 void Update () {
     particleCount = gameObject.particleSystem.particleCount;
     particleArray = new Particle[ particleCount ];
     //Debug.Log(particleCount );
 //    Debug.Log ( particleArray);
 }

     //removes partical on exit
 void OnTriggerExit( Collider col ){
         removeParticle();
     
 }
 
 void findParticle(){
             //somehow find the particular particle i want to destroy
 }
 
 void removeParticle(){
             //then remove it
     //remove(findParticle());
 }

}

particle.png (118.7 kB)
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

1 Reply

· Add your reply
  • Sort: 
avatar image
-1

Answer by thef1chesser · Oct 24, 2013 at 08:42 AM

Well to destroy a particle.

UnityEngine.Object.Destroy(particle);

Edit: if you just want to destroy the other particle

OnTriggerExit(Collider col) { UnityEngine.Object.Destroy(col.collider); }

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 Rickstrife · Oct 24, 2013 at 09:06 AM 0
Share

I tried adding that but it didn't remove the particle correctly it still was there floating off into the distance >:P

avatar image thef1chesser · Oct 24, 2013 at 09:21 AM 0
Share

what if you rebuild it in such a way taht the particles themselves check if they have exited the sphere.

so the particles have the OnTriggerExit and you just say
UnityEngine.Object.Destroy(this);

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

15 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

Related Questions

Changing particlesystem at runtime 0 Answers

Why does my particle system get enabled with a delay? 2 Answers

Can you still not change the Velocity of spawned particles? 2 Answers

Destroy particles based on bounds not lifetime 0 Answers

Multiple Cars not working 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