Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

Sign in to follow this  
T3kaT0kIkuTa

[C#]Particle Magnet

Recommended Posts

This script simulates a magnet for particles.

 

How to use:

- Create new GameObject and assign script

- Assign ParticleSystems and tweak variables

Please login or register to see this code.

Unity_2013_12_14_10_36_11_525.jpg

  • Like 3

Share this post


Link to post
Share on other sites

Thanks for the share! I can imagine this being useful in the future, especially for some cool visual effects.

Share this post


Link to post
Share on other sites

Although I am not entirely sure why this is happening in the FixedUpdate function... There is no physics being calculated in the frame. Also, FindObjectsOfType is terrible when it's called every frame (especially in FixedUpdate), so I HIGHLY recommend you to remove it or at least create an InvokeRepeating.

Share this post


Link to post
Share on other sites

Thanks.

I edited the script. Now it should call FindObjectsOfType, only if no ParticleSystems are attached.

Edited by T3kaT0kIkuTa

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...