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

Incorrect script locations referenced in console.

Discussion in 'Editor & General Support' started by salehi-gamedesign, Nov 26, 2019.

  1. salehi-gamedesign

    salehi-gamedesign

    Joined:
    Apr 30, 2018
    Posts:
    15
    Hi,

    I periodically make copies of my Unity project folder for version control and open a new instance of the project from one of the newly created copies.

    I have an issue where scripts referenced in the console (e.g. with error reports) are referencing scripts located in the older project folders please see screenshot).

    2019-11-26 23_14_35-Window.png

    In the screenshot above the console is referencing scripts in the folders for versions v1_007 and v1_009 despite the project being opened from the v1_010 folder.

    In each version of the project the scripts are located in the project 'Assets' directory inside a folder called, '!Scripts'. The scripts are found here and within a few other sub folders.

    Does anyone know why this is happening and how it can be corrected?

    Thanks in advance.
     
    Last edited: Nov 26, 2019
  2. salehi-gamedesign

    salehi-gamedesign

    Joined:
    Apr 30, 2018
    Posts:
    15
    I managed to find a partial solution:

    Removing all .meta files from the script folders seemed to fix the incorrect script paths listed in the console, however manually clearing the .meta files each time I make a copy of the project folder will become quite tiresome as the project grows larger.

    Does Unity have a in-built way of clearing all .meta files or some other workaround?
     
  3. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    Clearing all your meta files would be damaging to your project, as the meta files are what Unity uses to track anything in the Assets folder. You're likely to break any inspector references to components, prefabs, or other assets when you delete meta files.

    https://docs.unity3d.com/Manual/BehindtheScenes.html

    I'd suggest just using real version control software instead of the system you're doing.
     
  4. salehi-gamedesign

    salehi-gamedesign

    Joined:
    Apr 30, 2018
    Posts:
    15
    Thanks for the response.

    Is there a way to save a project to a backup location from within Unity such that when the duplicate project copy is opened it correctly references the new copies of the scripts from within its own location instead of pointing to the original directory?

    I'd like to keep the process simple without adopting third party version control software if its possible.
     
  5. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    What I always do is just close Unity, and create a zip file of the entire project folder. Optionally leave out the library folder and a few other items which don't really need to be backed up. Set the zip file aside as the backup (I usually just throw it over to my cheap consumer NAS device).

    That's of course when I'm doing a project which I'm not using version control, but I'll use version control for anything I'm getting serious on.