Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 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 /
  • Help Room /
avatar image
0
Question by jernaben · Sep 05, 2020 at 08:58 PM · collisiondelayparticle collision

making a delay on particle collider spawn?

I made a particle effect with collision. However, I would like the particle colliders to spawn a little later than the particle effects, so that the particle does not have colliders for the first few moments of its lifespan. how can I do this?

Comment
Add comment · Show 7
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 BenWiller1989 · Sep 06, 2020 at 02:01 PM 1
Share

Now i see what you are trying to do. A Particle Collisionmodul is not a Collider Component! So you are trying to access something, thats not attached to your scriptholder. Use the following code :

  ParticleSystem particlesystemVariable ;
 ParticleSystem.Particle[] particles = new ParticleSystem.Particle[particlesystemVariable .particleCount];
 
      void Start()
          {
     
              particlesystemVariable = gameObject.GetComponent<ParticleSystem> ();
              StartCoroutine(DelayCollider());
         
          }
         
          IEnumerator DelayCollider()
          {
 for (int i = 0; i < particlesystemVariable .particleCount;i++){
 particles [i].velocity = 20f;
 }
 
                 var collisionVariable = particlesystemVariable .collision;
                 collisionVariable .enabled = false;
     
              yield return new WaitForSeconds(delayTime);
     
             var collisionVariable = particlesystemVariable .collision;
             collisionVariable .enabled = true;
     
          }
         
          // Update is called once per frame
          void Update()
          {
              
          }

avatar image jernaben BenWiller1989 · Sep 06, 2020 at 02:25 PM 0
Share

That was very nice of you,

However, I get error; "the name "particlesystemVariable" does not exist in the current context. and

a local variable or function named "collisionVariable" is already defined in this scope

What am I supposed to do with those?

avatar image BenWiller1989 jernaben · Sep 06, 2020 at 02:35 PM 0
Share

Uff, :D You really have no idea, do you? "particlesystemVariable was an example, of a Variable, that you need to declare. Like : ParticleSystem particlesystemVariable ;. I edit the example i sent you.

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by BenWiller1989 · Sep 05, 2020 at 09:01 PM

Use a Coroutine and set the Collider.enabled = true or false?

Comment
Add comment · Show 3 · 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 jernaben · Sep 06, 2020 at 01:33 PM 0
Share

thanks. I am currently trying that. however it doesnt work. I am no programmer, so no surprise. I am getting an error, saying there is no "Collider" attached to the particle. the particle generates its own colliders, so I have no idea how to access them through the script?

{ public float delayTime = 3f; private Collider col;

 void Start()
 {

     StartCoroutine(DelayCollider());

 }

 IEnumerator DelayCollider()
 {
     col = GetComponent<Collider>();
     col.enabled = false;
     yield return new WaitForSeconds(delayTime);
     col.enabled = true;
 }



 // Update is called once per frame
 void Update()
 {
     
 }

}

avatar image BenWiller1989 jernaben · Sep 06, 2020 at 01:38 PM 0
Share

Well, did you attach a ColliderComponent to the scriptholder? Can you send a screenshot of the Inspector of the scriptholder?

avatar image jernaben BenWiller1989 · Sep 06, 2020 at 01:41 PM 0
Share

I made the particle generate the Colliders in the inspector. And I added the script to the particle

alt text

screenshot1.png (75.4 kB)

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

278 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 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

How do I make my particle system detect/mark a floor collision? 0 Answers

How can i set gameobject to inactive аfter delay on CollisionEnter 1 Answer

Disabling the particle 1 Answer

Disable collisions between particles 0 Answers

Network collision delay problem 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