A type or namespace that is used in the program was not found. You might have forgotten to reference (References) the assembly that contains the type, or you might not have added the required using directive. Or, there might be an issue with the assembly you are trying to reference.
Check "Character Controller". in line number 13.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerController : MonoBehaviour
{
CharacterController charactercontroller;
public float MovementSpeed = 5;
public float gravity = 9.8f;
float yMovement;
// Start is called before the first frame update
void Start()
{
charactercontroller = GetComponent<CharacterController>();
}
// Update is called once per frame
void Update()
{
float horizontal = Input.GetAxis("Horizontal") * MovementSpeed;
float vertical = Input.GetAxis("Vertical") * MovementSpeed;
charactercontroller.Move(transform.forward * vertical + transform.right * horizontal);
if(charactercontroller.isGrounded)
{
yMovement = 0;
}
else
{
yMovement -= gravity;
charactercontroller.Move(new Vector3(0, yMovement, 0));
}
}
}