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?
OnMouseDown over multiple Colliders.
Asked Answered
Change Z-axis of this objects
© 2022 - 2024 — McMap. All rights reserved.
Can you post the script please?
– MorleyI don't think that helps. My problem is mainly how Unity / the EventSystem chooses to invoke the function... OnMouseDown () { print (gameObject.name); }
– DermatoglyphicsPlease post the code since it'll make it easier for us to help you :)
– Duffey