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.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

All scripts are broken after project upgrade

Discussion in 'Scripting' started by CovalenceSTU, Mar 14, 2020.

  1. CovalenceSTU

    CovalenceSTU

    Joined:
    Sep 10, 2018
    Posts:
    63
    I upgraded one of my projects from 2017.2.0f3 to 2018.4.19f1 LTS (which was released today), and now, all my scripts don't work. I get a message saying "No MonoBehaivor scripts in this file, or their names do not match the file name" when I open them in the inspector. I do have MonoBehaivor a script in the file, and its name is the same as the file name (
    public class FileName : MonoBehaivor { (...) }
    ).

    All the scripts worked fine in 2017.2, is there anything I can do to fix this?
     
    Last edited: Mar 14, 2020
    Hellshot666 likes this.
  2. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,151
    Try deleting your csproj files and I think the sln file. It should rebuild those when you open the project again. If that doesn't work, delete the library.

    Also have a backup or a version control system in place before doing big upgrades or deleting stuff. (if you don't already)
     
    Hellshot666 likes this.
  3. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,594
    Hellshot666 likes this.
  4. CovalenceSTU

    CovalenceSTU

    Joined:
    Sep 10, 2018
    Posts:
    63
    I tried deleting both of them and letting it rebuild and the issue still happens.

    I made sure to backup everything except the Library folder before upgrading, if I can't find a solution I'll restore the backup and try upgrading to a different version (like 2019.2).

    Guess that's what I get for not copying and pasting the code :p. I checked the scripts and MonoBehaviour is spelled correctly.
     
    Hellshot666 likes this.
  5. CovalenceSTU

    CovalenceSTU

    Joined:
    Sep 10, 2018
    Posts:
    63
    I restored my backup and then upgraded it to the latest version of Unity (2019.3.5f1) instead and the scripts are still broken. Any other ideas?
     
    Hellshot666 likes this.
  6. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    Make sure you have resolved all compile errors before dealing with the no MonoBehaviour in script file issues. Unity doesn't know that there is a MonoBehaviour class in the script file until it can get a compile successfully completed, of everything.
     
    Hellshot666 likes this.
  7. CovalenceSTU

    CovalenceSTU

    Joined:
    Sep 10, 2018
    Posts:
    63
    I found a few errors in the Standard Assets (from obsolete script calls) and fixed them. Now it works! :D
     
    Hellshot666 and Joe-Censored like this.
  8. Seth01Master

    Seth01Master

    Joined:
    Feb 26, 2022
    Posts:
    19
    what do you mean by that? the same thing happened to me and I dont understand what you are talking about. (sorry, im new to unity)
     
  9. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    Please describe your issue and post any specific errors you might be having. What Unity versions did you upgrade from and to?
     
  10. Seth01Master

    Seth01Master

    Joined:
    Feb 26, 2022
    Posts:
    19
    I did not upgrade unity, I was downloading a unity asset but then it froze permanently and I was forced to quit unity. when I relaunched it nothing changed except all of my scripts show the same error message that CovalenceSTU had.
    All of the code in the scripts are still there and everything in the scripts should work perfectly fine, but all they show in the inspector is a script component named (Script) and a warning in it in place of where the scripts should be.
     
  11. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    Got it, please open a new thread. This one discusses upgrades.
     
  12. ghostvks

    ghostvks

    Joined:
    Nov 13, 2020
    Posts:
    3
    Hey everyone,
    I also had the same problem (I upgraded from 2019 to 2021) , I removed standard assets and their dependencies, and that fixed the issue
     
    Kshesho and Yoreki like this.