After installing Unity 2018.3 and opening project that was created with Unity 2017
I’m getting “missing ExtensionOfNativeClass attribute” error in Unity console window for one of the classes in the project.
Project builds without error in Visual Studio 2017.
Anyone has an idea what might be causing this error?
Thanks for your help jacovd.
Actually simple renaming of class helped to remove the issue.
The class that was causing the error used to inherit from MonoBehaviour
and it was simplified to regular class just like in your case so I believe
this was a problem very similar to the situation you described.
I had the same error and I found that I had a class that was once a ScriptableObject and an instance was created in Project. Later that class simplified to a regular class (removed inheritance) which made the instantiated object corrupted: you can only instantiate MonoBehvaiours and ScriptableObject and this class was not one of those anymore.
Look for your ScriptableObject in Project or GameObjects in Hierarchy that will show this message in Inspector:
The associated script can not be
loaded. Please fix any compile errors
and assign a valid script.
FWIW I had this same issue when I changed a script from MonoBehaviour to static - it was still in a Script component on my UIManager game object, so Unity was unhappy.
TL;DR This error means you have a Script component on a game object in your scene hierarchy which likely was, but no longer is, extending MonoBehaviour.
If your project is so big that you can’t find the prefab with the culprit.
You can search for like this is in the Project view
It can also be done by right clicking the script file->Find reference in scene
then copy the search string from the scene to the project view.
I removed all references to the script and it was still giving an error. The key for me was that I had to right-click on the script in Unity and “Reimport” it.
I had to remove the affected class from the project (from Visual Studio) and then re-create it.
No object in object inspector used the class but the error message was still present.
Once I removed, the class file, rebuilt and re-created the class again, the problem was gone.
You need rename class inheritance ScriptableObject as same as name Script
Just Search the Full name of the script which is giving this error in the hierarchy search field and then remove the referenced script as the script no longer inherit from monobehaviour and hence cannot be attached to any gameobject as a component.
Check a prefab which can contain some links to that Script, when it was inherited from MonoBehaviour