1.- There is a “Player” gameobject that has a script attached, that in the Update() evaluates if mouse was clicked with Input.GetMouseButtonDown. If true, it does a physics raycast to move or attack the player gameobject to whichever position was clicked on the screen.
2.- There is also a screen canvas that has a panel at the bottom for the skills bar. The panel has 4 images (ie: 4 slots), one for each skill, and each image has a script that implements IPointerClickHandler to detect a click, like in the following video by @BoredMormon
The click on the image is detected Ok. Problem is, that the physics raycast evaluates to true in the player script as well. So when a skill image is clicked, the player also moves/attacks to that position clicked.
Is there a way to “block” the physics raycast done in the player script if an image in the skill bar was clicked? The idea is that if an image in the skill bar was clicked, the physics raycast on the terrain (or enemies, or props in the terrain) is ignored.
The way I can think of (haven’t tried it yet though) is to move out of graphics raycast to physics raycast for the the UI elements as well, adding colliders to the images, and handling all clicks on the screen (either UI or gameobjects) with Input.GetMouseButtonDown on a script attached to the camera.