It should work, gameObject with the tag exist
RaycastHit2D _hitInfo = Physics2D.Raycast(transform.position, transform.right, distance);
Debug.DrawLine(transform.position, transform.position + transform.right * distance, Color.green);
if (_hitInfo.collider.CompareTag("Obstacle")){
Debug.Log("Hit");
faceDirection *= -1;
}
Instead I get: Object reference not set to an instance of an object
…which doesnt make much sense…
Same with:
_hitInfo.collider.tag == “Obstacle”