Type Not Found Errors

  08. Troubleshooting No Comments

Are you suddenly seeing errors in the Console originating from Power Inspector code, possibly triggered by making changes to code?
In particular, are you seeing this error in your Log window:
error CS0246: The type or namespace name ‘x’ could not be found. Are you missing an assembly reference?”
If so, it’s possible that Unity’s asset loading process has failed for some reason. To fix the issue, do the following steps:

  1. If the error messages are pointing to a specific type being missing, you can try locating and selecting the script asset that defines the missing type in the Project window, and selecting the menu item “Assets > Reimport“. Wait until the import process has finished, and try clearing your Console window to see if the errors are now gone. If importing has failed for multiple script assets, you might need to repeat this step multiple times for all the errors to go away.
  2. If you are unable to locate the specific file(s) causing the errors, you can also reimport all assets. To do this, select the menu item “Assets > Reimport All“. Please note that this might take several minutes (depending on your project size).
  3. If even this fails, you can try deleting the whole Library folder of your project, which will cause Unity to rebuild it from scratch.  Note that this can also take a long time with larger projects.
    1. First you will need to locate your Library folder in the root of your project folder path. The easiest way to find it is by right-clicking your Assets folder in the Project view and selecting the menu item “Show In Inspector” in the context menu that opens. You should now see the Library folder there next to the Assets folder.
    2. Close the Unity Editor if it’s still open.
    3. Delete the Library folder.
    4. Relaunch the Unity Editor and open your project again. Unity should start reimporting all your assets immediately. If Unity crashes during this import process, try launching it a second time, as that oftentimes solves the issue.