No Overload for Method "Move"

Hello guys,

Can anyone explain to me where am I going wrong with the Move() funtion ?
I am giving it 3 arguments however it keeps reterning error CS1501 No overload for method “Move” takes 3 arguments.

public float moveSpeed = 5;

void Update ()
{
GetComponent().Move(Input.GetAxis(“Horizontal”) * moveSpeed, 0, Input.GetAxis(“Vertical”) * moveSpeed);

}

From what i have gathered from documentation it should work just fine but it dosent.

First, you should cache the character controller instead of getting it each frame. That’s a HUGE oversight and a horrible habbit.

Second, Move() takes a Vector3 parameter, not 3 floats.

1 Like

Please use code tags in the future.
CharacterController.Move takes a Vector3 as argument.

public float moveSpeed = 5;
    // assign this via the inspector, or in Awake/Start
    public CharacterController characterController;

    void Update()
    {
        characterController.Move(new Vector3(Input.GetAxis("Horizontal") * moveSpeed, 0, Input.GetAxis("Vertical") * moveSpeed));
    }
2 Likes

Thank you for your help!

People like you make life of begiiners like me a lot easier :slight_smile: