Attack range does not work becasue CS1503 error

How do I solve this error you cannot convert float to Vector2 or Vector3

public class PlayerCombat : MonoBehaviour
{


    public Animator animator;

    public Transform attackPoint;
    public float attackRange = 0.5f;

    public LayerMask EnemeyLayers;


  


    // Update is called once per frame
    void FixedUpdate()
    {

        if (Input.GetKey("q"))
        {
            animator.Play("Cat_Attack");


            Attack();


        }



    }



    void Attack()
    {

        Collider2D[] hitEnemies = Physics2D.OverlapBoxAll(attackPoint.position,attackRange,EnemeyLayers);

        foreach (Collider2D enemy in hitEnemies)
        {

            Debug.Log("Hit Something");


        }


    }



    private void OnDrawGizmosSelected()
    {

        if (attackPoint == null)
            return;

        Gizmos.DrawWireCube(attackPoint.position, attackRange);



    }

  
  
      


}

Every error tells you exactly which line and column it is on but you didn’t post that important information so I’ll take a guess and say it’s the line 39 above. You’re passing completely incorrect values to the OverlapBoxAll call. Here’s the API docs for it which you can use to see what you should pass it: Unity - Scripting API: Physics2D.OverlapBoxAll

You’re passing the single float “attackRange” to the call which is expecting the Vector2 size of the box.

The errors are lines 39 and 60 where I have issues

sorry i forgot to post the lines first

39 has issue with Vector 2 and 60 with Vector3

Take a look at the signature of both of these methods and what they require and you should be able to fix the issue.

Thanks for the help, managed to solve it by adding Attackrange X and Y to create a hitbox for the attack

Some help to fix “Cannot implicitly convert type ‘Xxxxx’ into ‘Yyyy’:”

http://plbm.com/?p=263

Remember: NOBODY memorizes error codes. The error code is absolutely the least useful part of the error. It serves no purpose at all. Forget the error code. Put it out of your mind.

The complete error message contains everything you need to know to fix the error yourself.

Always start with the FIRST error in the list, as sometimes that error causes or compounds some or all of the subsequent errors.

The important parts of the error message are:

  • the description of the error itself (google this; you are NEVER the first one!)
  • the file it occurred in (critical!)
  • the line number and character position (the two numbers in parentheses)

All of that information is in the actual error message and you must pay attention to it. Learn how to identify it instantly so you don’t have to stop your progress and fiddle around with the forum.