MissingComponentException: There is no 'CharacterController' attached to the "Player" game object, but a script is trying to access it

Hi, How can I solution this?

MissingComponentException: There is no 'CharacterController' attached to the "Player" game object, but a script is trying to access it.
You probably need to add a CharacterController to the game object "Player". Or your script needs to check if the component is attached before using it.
UnityEngine.CharacterController.Move (UnityEngine.Vector3 motion) <0x38f54800 + 0x0005a> in <4641b023c24046ab89910597e580442a>:0
PlayerController.FixedUpdate () (at Assets/Scripts/PlayerController.cs:25)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerController : MonoBehaviour
{
    public float movimientoX;
    public float movimientoY;
    public CharacterController player;

    void Start()
    {
        player = GetComponent<CharacterController>();
    }

    void Update()
    {
        movimientoX = Input.GetAxis("JoystickIzqX");
        movimientoY = Input.GetAxis("JoystickIzqY");
    }
    private void FixedUpdate()
    {
        player.Move(new Vector3(movimientoX, 0.0f, movimientoY));
    }
}

The error says it, you need to have a CharacterController sitting in your PlayerController GameObject.

For now, you only have two components: Transform and PlayerController.

Click on Add Component > Physics > Character Controller
This will add it to your player, and you should see the error removed :slight_smile: