'why am I getting this 'the referenced script on this Behavior is missing!' error in Unity?

I'm trying to make a simple FPS movement script in Unity. I made a player called 'player' with a capsule collider, a rigidbody, and a camera. Everything worked fine until I finished writing the code for the WASD movement, then it said that my referenced script was missing. The script was exactly where it was before and hadn't been renamed. I deleted everything and started over, and got the same error.

the code:

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

public class movement : MonoBehaviour
{
    public Rigidbody player;
    public float m_speed, rotatespeed;

    void FixedUpdate()
    {
        if (Input.GetKey(KeyCode.W))
        {
            player.velocity = transform.forward * m_speed * Time.deltaTime;
        }

        if (Input.GetKey(KeyCode.S))
        {
            player.velocity = -transform.forward * m_speed * Time.deltaTime;
        }

        if (Input.GetKey(KeyCode.A))
        {
            player.velocity = -transform.right * m_speed * Time.deltaTime;
        }

        if (Input.GetKey(KeyCode.D))
        {
            player.velocity = transform.right * m_speed * Time.deltaTime;
        }

    }  

}


Solution 1:[1]

The filename must match the class name e.g.

Something.cs -> public class Something : MonoBehaviour

If you rename your file, Unity won't update the class name inside the file. This is also case sensitive if I am not mistaken

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Winjas Force