This isn’t a new idea to me but a new terminology is. So writing it down to help me remember. Cursor affordance!

An important GUI feedback mechanism to allow a player to receive information about possible actions via the cursor/pointer.

For example, can I attack this object, pick this object up, talk to this object, etc.

We all know what cursor affordance is when we see it, but it’s jolly good to know what it is called. [LGPLv3]

And a little bit of code to explain…

private bool InteractWithCombat() 
    RaycastHit[] hits = Physics.RaycastAll(GetMouseRay());
    foreach(RaycastHit hit in hits) 
    CombatTarget target = hit.transform.GetComponent<CombatTarget>();

    if( target == null ) continue;

    if (Input.GetMouseButtonDown(0))

    //return true here will signal the mouse is over a target
    return true;
  return false;