unity compiler has a problem

The associated script cannot be loaded. Please fix any compile errors and assign a new script.

the problem is :the script has no problem ,but one thing how strange it is that all the variables event the private variables are visible in the inspector value

has any one seen similar problem?

Sounds as if your inspector is in debug mode.

What is the exact error message? Usually there is a problem in a script.

I’ve seen this when I edited a previously valid C# script that no longer made the script “loadable”. Two off the top of my head:

  • I changed a class to “abstract” and made child classes. However I had a prefab loading that had this “abstract” class attached to a Game Object. An instance of an “abstract” class is not allowed.
  • I changed a base class inheritance in such a way that it no longer derived from MonoBehaviour somewhere down the inheritance change. This made it so further derived classes were also no longer a MonoBehaviour and so not allowed on a Game Object.

I’m sure there are plenty of other non-obvious reasons why that error message could appear.

I ve solved this problem later,although I dont know where it went wrong.
thks