Incorrect script locations referenced in console.

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).

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.

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?

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.

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.

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.

I think I’m late here but here is what i did without ruining my project or break any reference in inspector. close the project and go to library folder delete ScriptAssembilies folder and open the project again.

above comment seems to have worked for me. definitely need to use proper source control and not just duplicate the project constantly :slight_smile:

On Linux, I use rsync to duplicate all my projects to a new location. It seems to be usable under Windows.