Player_Movement_Controls.cs(22,44): error CS1503: Argument 1: cannot convert from 'Un

Hi,

I am getting this error:-

Assets\Scripts\Player_Movement_Controls.cs(22,44): error CS1503: Argument 1: cannot convert from ‘UnityEngine.Transform’ to ‘UnityEngine.Vector2’

This is my code:-

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Player_Movement_Controls : MonoBehaviour
{
    public Rigidbody2D rb;
    public Transform groundCheck;
    public float groundCheckRadius;
    public LayerMask whatIsGround;
    private bool onGround;

    void Start()
    {
        rb = GetComponent<Rigidbody2D>();
    }

    // Update is called once per frame
    void Update()
    {
        rb.velocity = new Vector2(3, rb.velocity.y);
        onGround = Physics2D.OverlapCircle(groundCheck, groundCheckRadius, whatIsGround);

        if (Input.GetMouseButtonDown(0) && onGround)
        {
            rb.velocity = new Vector2(rb.velocity.x, 3);
        }
    }
}

Thanks!

You probably meant to use groundCheck.position here:

Physics2D.OverlapCircle(groundCheck, groundCheckRadius, whatIsGround);
1 Like

Great Thank You SOO Much!!