Unity: “The referenced script (Unknown) on this Behaviour is missing!”

It happens when the file and the name class has not the same name.

Example:

  • The file is named SingleCube.cs
  • The class definition is public class Cube : MonoBehaviour

In this case, Unity is not able to link the file and the class. Both have to have the same name.

  • The file should be SingleCube.cs
  • And the class definition public class SingleCube : MonoBehaviour