Public Variables Not Displaying In The Inspector

I am having a serious issue. In my current project, the scripts say “No MonoBehavior scripts in the file, or their names do not match the file name”. I am bringing this up since my public variables are not showing up in the inspector. Are these issues related? Please respond ASAP.

The error is telling you that the class either does not derive from MonoBehaviour or the name of the class is not the same as the file name.
So your public variables aon’t show unless the two above conditions are met.

    // this class is derived from (is a sub class of) MonoBehaviour
    // Unity needs this for a class to be added to a GameObject
    public class MyScriptClass : MonoBehaviour
        public string myVariable = "My Variable";

    // the above code should also be contained in a file called MyScriptClass.cs