I create a brand new script through the Unity editor, doing nothing to it. Then when I try to attach it to an object I get this error:
"Can't add script component [script name] because the script class cannot be found. Make sure that there are no compile errors and that the file name and class name match."
This shouldn't happen! The file name and class name do match, and there aren't any compile errors. It's a brand new script!
does anyone have a clue what's going on?
Here's the script since you ask:
public class ClippingPlane : MonoBehaviour {
//material we pass the values to
public Material mat = Resources.Load("Glasses") as Material;
//execute every frame
void Update()
{
//create plane
Plane plane = new Plane(transform.up, transform.position);
//transfer values from plane to vector4
Vector4 planeRepresentation = new Vector4(plane.normal.x, plane.normal.y, plane.normal.z, plane.distance);
//pass vector to shader
mat.SetVector("_Plane", planeRepresentation);
}
}
and the name of the file is "ClippingPlane.cs" But it doesn't really matter what the code is or the filename since the same bug occurs with every script! Even if I make a new script in the inspector and don't touch it at all - but I'm repeating myself.
Edit: tried reimporting as that other post suggests. Still having the same issue.