public class PlayerCombat : MonoBehaviour
public Animator animator;
public Transform attackPoint;
public float attackRange = 0.5f;
public LayerMask enemyLayers;
// Start is called before the first frame update
// Update is called once per frame
ERROR HERE==> Collider2D hitEnemies = Physics2D.OverlapAreaAll(attackPoint.position, attackRange, enemyLayers);
foreach (Collider2D hit in hitEnemies)
if (attackPoint == null)
CS1503 is quite a common problem. It says that one of the data types is not right. In this case, I think you are mixing up Physics2D.OverlapAreaAll with Physics2D.OverlapCircle.
You’re using OverlapAreaAll, which needs two points and a layer mask. The two points are two opposite points in a rectangle. However, you are passing a float for the second parameter, not a transform.position.
If you use OverlapCircleAll then you have position, float, layermask. Perhaps that’s what you meant to use.
One more thing, though it may not be too important yet. If you use either of these in Update, you could end up using a lot of memory because they can keep on allocating more memory, depending the number of enemies. Or you may get glitches because of garbage collection. If you can predict the max number of enemies, you should really use OverlapCircleNonAlloc and OverlapAreaNonAlloc. They take a fixed size array, which would typically be the max number of enemies you can have at any one time. Parameters are different so check them out.