OnMouseDown over multiple Colliders.
Asked Answered
D

1

0

I have a few overlapping GameObjects in my Scene. Each one has a Script containing the OnMouseDown function, a Collider2D and a SpriteRenderer.
When I click the region where the Colliders intersect, I would expect the GameObject that is rendered on top of all the others to execute its OnMouseDown function. But that is not the case.
Any Ideas why or how to make sure the GameObject rendered last also executes?

Dermatoglyphics answered 14/8, 2019 at 18:37 Comment(3)

Can you post the script please?

Morley

I don't think that helps. My problem is mainly how Unity / the EventSystem chooses to invoke the function... OnMouseDown () { print (gameObject.name); }

Dermatoglyphics

Please post the code since it'll make it easier for us to help you :)

Duffey
P
0

Change Z-axis of this objects

Polaris answered 10/7 at 21:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.