- Home /
ExtensionOfNativeClass attribute missing error in Unity 2018.3
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?
EDIT
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.
Answer by jakovd · Dec 19, 2018 at 01:24 PM
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.
This same thing happened to me with the new prefabs. Simplified a class to not derive from $$anonymous$$onoBehaviour and removed the components from the game object but forgot to apply the changes to its prefab.
In my case this worked:
I have one object and it have only one script,the static script
Go to the object and delete it
if you have a static class in the new versions it don't need to be added to a object, you dont need to place the scritp in any place,only have it created
SPOT ON!!! I think this errors need a less misterious statement.
@jakovd I can't find the object that uses the script ! any help? select dependencies doesn't find anything...
Try checking out your prefabs too. $$anonymous$$anually.
If you have name of the Script just add once again MonoBehaviour to it and check in Rider AssetReferences. If you don't have Rider, you can search for the GUID stored in ProblematicScript.cs.meta.
Same thing happened to me, I have $$anonymous$$onoBehavior classes and attached to prefabs, later then I changed them to static classes.
Answer by kthrose · Apr 18, 2019 at 04:53 PM
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.
Hey i had this case and removed the original object but its still showing that error :/
Answer by PaulUsul · Nov 30, 2019 at 12:37 PM
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
ref:Assets/Scripts/Folder/CulpritClassName.cs
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.
THANK YOU. Never thought to search for refs in the project view.
Answer by kchodorow · Sep 01, 2021 at 06:56 PM
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.
Answer by kubajs · Dec 17, 2019 at 10:42 PM
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. HTH