I have a hand icon, I wan’t it to be active when I point my cursor at a object with ether of these two tags: Object and Interactable. But it doesn’t work, it does disable the other one, but even when I look at the object the other one doesn’t become enabled. Got this much done:
void Update()
{
Ray ray = cam.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
if (Physics.Raycast(ray, out hit))
{
if (hit.collider.tag == "Interactable" || hit.collider.tag == "Object")
{
crosshairDot.GetComponent<Image>().enabled = false;
crosshairHand.GetComponent<Image>().enabled = true;
}
if (hit.collider.tag != "Interactable" || hit.collider.tag != "Object")
{
crosshairDot.GetComponent<Image>().enabled = true;
crosshairHand.GetComponent<Image>().enabled = false;
}
}
}
}