I have such a question. I have some objects on the screen. These objects contain box collider. When I click on them something happens, it does not matter. Now I do not know how to do when I click somewhere on the screen but not on one of the objects, to give me Debug.Log("Bad Click, here is no object"); I was thinking of taking the cursor position and detecting if it is above an object and if not, but I do not understand.
public GameObject[] objects;
public void Start()
{
foreach (GameObject ob in objects)
{
ob.GetOrAddComponent<ColliderEventSystem>().ColliderEntered += Click;
}
}
private void Update()
{
//Do something when I click wrong
}