Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Bug [Solved] Unity claims scripts are missing that are there. it can even show them in the root prefab

Discussion in 'Editor & General Support' started by soomon, Sep 25, 2023.

  1. soomon

    soomon

    Joined:
    Sep 24, 2020
    Posts:
    10
    Hello,

    yesterday my game was working 100%. No issues.
    Today I open Unity and my game is broken!

    Unity claims 2 missing scripts on many prefabs. Yesterday they were there.
    The root prefab shows the script's name but the script component has the name "Script" instead of the scripts name, see attached file "root prefab".

    When I click on the scripts name, the project view jumps to the script. It is there and Unity knows it???

    In prefab variants the scripts are claimed to be missing, although they are clearly not! , see attached file "prefab variant".

    There are no compile errors.
    Reinstalling the package those scripts are from doesn't change anything. That makes sense to me because the package was not updated. I know this since it is my own git package.
    Restarting Unity also doesnt help.

    I did get a blue screen while opening my Unity project this morning. After restarting the PC Unity opened as usual but now claims these missing scripts that are clearly there.

    Please help me.
     

    Attached Files:

    Last edited: Sep 25, 2023
  2. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    6,186
    What does your version control history tell you?
     
  3. soomon

    soomon

    Joined:
    Sep 24, 2020
    Posts:
    10
    nothing that makes sense to me. The only thing that seems to have changes is "PackageManagerSetting.asset".

    I already reset to yesterday's last commit. nothing changes. That makes perfect sense, since nothing has changed.
    If anything changed on the Unity file structure it is outside of my version control. So maybe in the git exclusion file

    Code (CSharp):
    1. # This .gitignore file should be placed at the root of your Unity project directory
    2. #
    3. # Get latest from https://github.com/github/gitignore/blob/main/Unity.gitignore
    4. #
    5. /[Ll]ibrary/
    6. /[Tt]emp/
    7. /[Oo]bj/
    8. /[Bb]uild/
    9. /[Bb]uilds/
    10. /[Ll]ogs/
    11. /[Uu]ser[Ss]ettings/
    12.  
    13. # MemoryCaptures can get excessive in size.
    14. # They also could contain extremely sensitive data
    15. /[Mm]emoryCaptures/
    16.  
    17. # Recordings can get excessive in size
    18. /[Rr]ecordings/
    19.  
    20. # Uncomment this line if you wish to ignore the asset store tools plugin
    21. # /[Aa]ssets/AssetStoreTools*
    22.  
    23. # Autogenerated Jetbrains Rider plugin
    24. /[Aa]ssets/Plugins/Editor/JetBrains*
    25.  
    26. # Visual Studio cache directory
    27. .vs/
    28.  
    29. # Gradle cache directory
    30. .gradle/
    31.  
    32. # Autogenerated VS/MD/Consulo solution and project files
    33. ExportedObj/
    34. .consulo/
    35. *.csproj
    36. *.unityproj
    37. *.sln
    38. *.suo
    39. *.tmp
    40. *.user
    41. *.userprefs
    42. *.pidb
    43. *.booproj
    44. *.svd
    45. *.pdb
    46. *.mdb
    47. *.opendb
    48. *.VC.db
    49.  
    50. # Unity3D generated meta files
    51. *.pidb.meta
    52. *.pdb.meta
    53. *.mdb.meta
    54.  
    55. # Unity3D generated file on crash reports
    56. sysinfo.txt
    57.  
    58. # Builds
    59. *.apk
    60. *.aab
    61. *.unitypackage
    62. *.app
    63.  
    64. # Crashlytics generated file
    65. crashlytics-build.properties
    66.  
    67. # Packed Addressables
    68. /[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin*
    69.  
    70. # Temporary auto-generated Android Assets
    71. /[Aa]ssets/[Ss]treamingAssets/aa.meta
    72. /[Aa]ssets/[Ss]treamingAssets/aa/*
    73.  
    74. /Assets/zzz_UnityAssetPacks/
    75. /Packages/com.singularitygroup.hotreload/
    I did however get a blue screen when opening my project this morning. After a reboot it opened, but now claims these missing files.

    When trying to add the same scripts to a new prefab I get an error stating "Can't add script component 'ProjectileWeapon' because the script class cannot be found. Make sure there are no compile errors and the file name and class name match."
    Both is the case. There are no compile errors and file & class name are the same
     
    Last edited: Sep 25, 2023
  4. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    4,363
    Try deleting the Library folder with the project closed. Possibly some stale or corrupt cache data, especially after a bluescreen.

    If you happen to see bluescreens more than once per week (or even per month depending on how intensive you use the PC), you should definitely update drivers and perform a hardware check, preferably with some intense check tool that boots off of a stick or floppy.
     
    soomon likes this.
  5. soomon

    soomon

    Joined:
    Sep 24, 2020
    Posts:
    10
    oh dude THANK YOU!
    Deleting the library folder fixed it. The blue screen was surprising to me, it's not normal for me to get one. Not sure what happened there. But the main thing is that my Unity project is not screwed up.

    Thanks again!!!
     
    CodeSmile likes this.