V
V
vitalii_andrash2020-12-01 17:19:35
Unity
vitalii_andrash, 2020-12-01 17:19:35

The click works immediately on two objects in different layers, how to fix it?

Hello. I'm making a clicker and ran into a problem:
I have a ClickButton object stretched to the full width of the canvas, when clicked, the Click function is triggered, causing the animation. There is also an Emitter above the canvas, which spawns objects from prefabs (animation from Particle System with 2D Collider and Rigidbody) flying over ClickButton, they are controlled by a script that causes a destruction animation when clicking on them. And now it turns out that when you click on a flying object, both functions are triggered, respectively, 2 animations are played. How to make it so that only the destruction animation works?

I also note that there are UI elements above the "ClickButton", when clicking on which the animation does not play, everything is ok.
The layers of ClickButton and flying objects are different, ClickButton is located lower in the hierarchy.

Screenshots from the inspector
5fc650db46359643041741.png
5fc650e3134b9704647249.png

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question