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
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.