I’m at a loss on this issue.
Basically on mouse movement I want to detect if I pass over two colliders, this works but if I move the mouse quickly only the first collision is detected.
Any ideas?
if (Input.GetMouseButton(0))
{
RaycastHit2D hit = Physics2D.Raycast(mainCamera.ScreenToWorldPoint(Input.mousePosition), Vector2.zero);
if (hit)
{
if (hit.collider.tag == "validTag")
{
if (firstCollider = null)
{
Debug.Log("Hit First Collider");
firstCollider = hit.collider;
}
else
{
if (hit.collider != firstCollider)
{
Debug.Log("Hit Second");i
}
}
}
}
}