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
1
Question by Gatenus · Jul 14, 2020 at 06:36 PM · particlesparticle systemclickableparticle-systemclicking

OnMouseDown not working on my Particle System

DISCLAIMER: this is my first ever Unity project (though I have programmed some before so I know a bit of lingo) and I'm mostly just playing around and learning. I am NOT necessarily looking for a perfect/best/optimized solution, I'm looking for a solution to my question as posed (if possible).
.
WHAT I HAVE: I'm building a board game where the board is planets around a sun, each with "orbit" rings around them and links between the rings (the orbits and links are what the player avatars "ride" on). The rings and links are all particle effects with a script containing an "OnMouseDown()" method.
.
THE GOAL: My player avatars to move between adjacent orbits (NOT tracks) when I click on those paths, including the particle effect rings and links.
.
MY PROBLEM: Everything I want to do works so far - clicked board objects move the player to them with no errors - except when I try to click on the Particle System orbits/links and nothing happens.
.
WHAT I'VE TRIED:
=> Debug.Log tags to see where/when I'm executing the code and how far I get within it. The code behaves flawlessly when clicking the planets and moons, but doesn't even activate and enter the method when I [try to] click on the orbit Particle Systems.
=> Adding the script to one of the linear Particle Systems whose transform.position is NOT inside another object: the script still didn't activate.
.
MY HYPOTHESES:
1) Maybe Particle Systems only click on an infinitesimal transform.position point(s) (of the system or even the individual particles???) and not the area/volume defined by either the Shape attribute or the [particle size + direction&duration of travel]. Possible solution: add a collider??? ( I'm not sure how to do that correctly IF it would even work at all)
2) Perhaps there's something about Particle Systems that precludes clicking on them altogether. Possible solution: replace the Particle Systems with images that can be clicked on?
.
THE HELP I'M SOLICITING: suggestions (with instructions) on ways I could change the area/volume, or the particles, of a Particle System so that an OnMouseDown method linked to it will trigger. Any help would be appreciated.
.
alt text

untitled.png (422.4 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
0

Answer by karl_jones · Jul 14, 2020 at 10:38 PM

OnMouseDown requires the object to have a collider and ParticleSystems dont have one by default. You can add a collider however you need to decide how accurate the collision detection needs to be. The simplest would be a box collider set to match the particle system bounds. You could update it every frame to match the exact size or just set it to a static value. If you want it so it only happens when you click on an actual particule then you will likely need a mesh collider. You can get a mesh version of the system by calling BakeMesh on ParticleSystemRenderer and then feeding that into a Mesh collider. It's going to hit your performance more than a simple box though. Try a box and see how that goes first. Just select the particle system gameObject and add a collider component.

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

213 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

Related Questions

changing the radius of a particle system with unity script 1 Answer

Particle system error in world space 0 Answers

Particle Effect appears low-quality in-game. 0 Answers

Some question about ParticleSystem.emit() rendering 0 Answers

Can I shoot a ray from a particle that hit a collider? 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