[Tip] Is it not working for you?

I couldn’t get the mouse to click on the collider.
After some trial and error I fixed it, here’s what I checked for:

  1. Core Game Area must be between the camera (Z) position and you background position. In my case, my Core Game Area was set to the same ZPosition as my camera, so I guess that wasn’t helping to being recognized.

  2. Core Game Area must be closer to the camera (on Z, again), than any of the other GameObjects (i.e. attackers, defenders). If not, it would click on them instead of my Core area collider.

So, in short: make sure you Z position of all elements in your game make sense.
Hope it helps and saves you some time.

Thank you for the tip. This actually helps a lot!

1 Like

Also I found that deleting the other debug line of code in the Projectile Script
"Debug.Log(“I Hit: " + otherCollider.name);”

Helped get that to work as well.

Cheers

Maybe this will help someone, no matter what I did the OnMouseDown would not work. Finally I added the Update method for testing and it magically started working, after removing the Update method it continued working, my best guess is it just needed to recompile the script.

Privacy & Terms