Compiler Error, how to fix?

I have been using unity for a while and unity just started giving me compiler errors on a script that I have had working for a while. Can someone why unity is giving me the compiler error, Assets/Standard Assets/Character Controllers/Sources/Scripts/FPSInputController.js(1,21): BCE0018: The name 'CharacterMotor' does not denote a valid type ('not found'). Did you mean 'UnityEngine.CharacterJoint'? on this script `private var motor : CharacterMotor;

// Use this for initialization function Awake () { motor = GetComponent(CharacterMotor); }

// Update is called once per frame function Update () { // Get the input vector from kayboard or analog stick var directionVector = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));

if (directionVector != Vector3.zero) {
    // Get the length of the directon vector and then normalize it
    // Dividing by the length is cheaper than normalizing when we already have the length anyway
    var directionLength = directionVector.magnitude;
    directionVector = directionVector / directionLength;

    // Make sure the length is no bigger than 1
    directionLength = Mathf.Min(1, directionLength);

    // Make the input vector more sensitive towards the extremes and less sensitive in the middle
    // This makes it easier to control slow speeds when using analog sticks
    directionLength = directionLength * directionLength;

    // Multiply the normalized direction vector by the modified length
    directionVector = directionVector * directionLength;
}

// Apply the direction to the CharacterMotor
motor.inputMoveDirection = transform.rotation * directionVector;
motor.inputJump = Input.GetButton("Jump");

}`

take into mind that this script was working for me earlier, but it just suddenly started not working

My bet is you either accidentally removed CharacterMotor from the project, or you moved your js file into the same compilation pass as CharacterMotor (or vice versa)

Since CharacterMotor is in c#, you need it to be compiled earlier to see it, which means CharacterMotor has to be in either Plugins, Standard Assets or Pro Standard Assets, and your script has to be anywhere else besides those folders

I modified the script so as not to have dependencies. Be careful if you also have a character controller if using this script (I haven’t noticed anything bad, but who knows…). Also notice I commented out //directionLength = directionLength * directionLength;. I also added var yAxisMove = 1.0; (change to zero for horizontal rotation only).

#pragma strict

var rotationSpeed = 10.0;
var lerpSpeed = 20.0;
var yAxisMove = 1.0;

private var speed = new Vector3();
private var avgSpeed = new Vector3();
private var dragging = false;
private var targetSpeedX = new Vector3();

function OnMouseDrag()
{
dragging = true;

// Get the input vector from keyboard or analog stick
var directionVector = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));

if (directionVector != Vector3.zero) {
	// Get the length of the directon vector and then normalize it
	// Dividing by the length is cheaper than normalizing when we already have the length anyway
	var directionLength = directionVector.magnitude;
	directionVector = directionVector / directionLength;
	
	// Make sure the length is no bigger than 1
	directionLength = Mathf.Min(1, directionLength);
	
	// Make the input vector more sensitive towards the extremes and less sensitive in the middle
	// This makes it easier to control slow speeds when using analog sticks
	//directionLength = directionLength * directionLength;
	
	// Multiply the normalized direction vector by the modified length
	directionVector = directionVector * directionLength;
}

}

function Update ()
{

if (Input.GetMouseButton(0) && dragging) {
    speed = new Vector3(-Input.GetAxis ("Mouse X"), Input.GetAxis("Mouse Y"), 0);
    avgSpeed = Vector3.Lerp(avgSpeed,speed,Time.deltaTime * 5);
} else {
    if (dragging) {
        speed = avgSpeed;
        dragging = false;
    }
    var i = Time.deltaTime * lerpSpeed;
    speed = Vector3.Lerp( speed, Vector3.zero, i);   
}

transform.Rotate( Camera.main.transform.up * speed.x * rotationSpeed, Space.World );
transform.Rotate( Camera.main.transform.right * speed.y * yAxisMove * rotationSpeed, Space.World );

}