Forum rules - please read before posting.

Upgrades: Difference between importing over the top and deleting first

As my project is being managed under version control and needed to be upgrade, I though I'd do an experiment to compare the different methods of upgrading Adventure Creator.

  • Method 1: I re-imported the new version over the top of the old one. The import dialog had selected the items that were 'new' or 'updated' and these are what were imported. Presumably the other files were unchanged from the old version and Unity detects this.
  • Method 2: I deleted the Adventure Creator folder and Adventure Creator.meta from the Assets folder and then imported the new version completely afresh (i.e. all content).

I found a couple of interesting things.

  1. Firstly, the fresh import did not include a number of files that were present in the 'over the top' version.
  2. Secondly, there were a number of differences between files. In most cases these were .meta files, which is perhaps to be expected. However, there were also a few .prefab files and a .mat file that had differences, which seem more significant.

Based on the above, and in particular the first point, is it actually better to upgrade by deleting Adventure Creator and re-importing, rather than installing over the top?

Comments

  • btw I am using an old version of Unity (v5) and this was not an upgrade to the most recent version of AC, so perhaps the situation is different now.

    However, either way, the question still stands.

  • Firstly, the fresh import did not include a number of files that were present in the 'over the top' version.

    As in, the previous version had files that the newer does not? Which files in particular? It may be that they've been deprecated and no longer used, but it's rare.

    Secondly, there were a number of differences between files. In most cases these were .meta files, which is perhaps to be expected. However, there were also a few .prefab files and a .mat file that had differences, which seem more significant.

    Sometimes prefabs are updated to account for new scripts / features that are included as part of that release, modified to work with new changes made, or updated due to changes made to Unity itself.

    As for which upgrade method is best, it's rare that such a choice would make a significant difference or cause issue. I'd personally urge to stick to method 1, though, because if any meta file change did occur - and this too should be rare - then Unity should autocorrect this. Otherwise, you may find a lost prefab reference if this affected something used by one of your scenes.

  • As in, the previous version had files that the newer does not? Which files in particular? It may be that they've been deprecated and no longer used, but it's rare.

    This was an upgrade from 1.55a to 1.64.5 and the files that were present when upgrading in-place but not present when installing afresh were as follows:

    • ~\Managers.meta
    • ~\Graphics\Materials\StaticObstacle 1.mat
    • ~\Graphics\Materials\StaticObstacle 1.mat.meta
    • ~\Managers (empty folder)
    • ~\Prefabs\Camera\GameCamera2DDrag 1.prefab
    • ~\Prefabs\Camera\GameCamera2DDrag 1.prefab.meta
    • ~\Prefabs\Camera\TintMap 1.prefab
    • ~\Prefabs\Camera\TintMap 1.prefab.meta
    • ~\Prefabs\Navigation\HotspotCentre 1.prefab
    • ~\Prefabs\Navigation\HotspotCentre 1.prefab.meta
    • ~\Resources\MusicEngine 1.prefab
    • ~\Resources\MusicEngine 1.prefab.meta

    Sometimes prefabs are updated to account for new scripts / features that are included as part of that release, modified to work with new changes made, or updated due to changes made to Unity itself.

    I must admit that I don't follow all of this - I've got a lot to learn about how Unity operates! However, it surprises me that the two methods give different results, as surely Unity is just copying one file over another, no?

    Also, I would have thought that installing from scratch would be more likely to be the correct method as this ensures there isn't any baggage that might be left over from prior versions by mistake.

    One thing I will note, is that Asset Serialisation is set to 'Force Text', so I wonder if some of the differences come from the serialisation process rather than the original files?

  • The files you mention aren't (or shouldn't be) part of AC's package. A " 1" in the filename suggests that those assets are duplicates.

    Were those assets (and their originals, e.g. "/Resources/MusicEngine.prefab") present before you imported? I'm not sure how they came about, but so long as your scenes don't reference these duplicates, they should be safe to delete.

    as surely Unity is just copying one file over another, no?

    Unity will try to cross-match assets via their meta file. It's a process best explained by Unity, though, I'm not in a position to comment on how exactly it works.

  • The files you mention aren't (or shouldn't be) part of AC's package. A " 1" in the filename suggests that those assets are duplicates.

    That's interesting! I am recreating an old project using version control, and the first thing I am doing is importing the original AC I was using before and then upgrading it.

    The process I followed was:

    1. Create a new project in Unity, set the two version-control related settings and then quit. Commit the resulting project structure.
    2. Restart Unity, install AC 1.55a from the .unitypackage file. Quit Unity and commit the new files.
    3. Restart Unity, install AC 1.64.5 from the .unitypackage file. Quit Unity and look at the changes.

    In my second approach, I deleted the two Adventure Creator files between steps 2 and 3. The two things I am comparing are the same steps performed with and without deletion and comparing them to each other (not to the previous 1.55a version, where I would expect to see lots of differences).

    I wonder if these files were accidentally included in the 1.55a distribution package and subsequently removed in a later version, and that Unity isn't good at clearing out removed files. That would explain it, I think. It might also explain the empty Managers folder that was removed.

    Unity will try to cross-match assets via their meta file. It's a process best explained by Unity, though, I'm not in a position to comment on how exactly it works.

    Fair enough! :-)

    As for which upgrade method is best, it's rare that such a choice would make a significant difference or cause issue. I'd personally urge to stick to method 1, though, because if any meta file change did occur - and this too should be rare - then Unity should autocorrect this. Otherwise, you may find a lost prefab reference if this affected something used by one of your scenes.

    If I understand you correctly, you are saying that either method should result in the same set of files, except that if there have been any renames then importing over the top will allow Unity to detect the rename and update any references (which it can't do if the original folder was deleted). Is that correct? If so, then that is a good argument for doing a standard import.

    On the flip side, it looks like Unity doesn't remove files that have been deleted, so these will be left hanging around if you use this method. However, that shouldn't have any negative side-effects. Good to be aware of, though.

    In this case (where there are no project files yet) it therefore makes sense to go with the clean import, but to use the other method in future upgrades.

    This has been a very helpful thread - thanks for your help.

  • you are saying that either method should result in the same set of files, except that if there have been any renames then importing over the top will allow Unity to detect the rename and update any references (which it can't do if the original folder was deleted). Is that correct?

    Again, this is more for Unity to say - as it can be a bit fussy somtimes. If a file has been renamed or moved, it'll remain as such even after importing - provided the meta file matches. But this does then retain a disconnect so far as where an asset is and where it was intended to be. Usually this doesn't matter, but may give the odd message upon importing.

  • Hmmm... interesting. Sounds like importing is the way to go then, probably in every single situation except the one I'm in right now... :wink:

  • FYI: I found this thread, which seems to imply that the "1" files are created by Unity if you import an asset that would overwrite an existing asset but whose GUID has changed. However, the thread is a bit rambling and inconclusive, so I'm not 100% sure this is what happened: https://forum.unity.com/threads/upgrading-a-plugin-in-unity-5-duplicates-files-if-you-delete-the-files-first-broken.322226/

    I also found this Unity design document which talks about how the import process was changed between Unity 4 and Unity 5, which is relevant, though still not a complete explanation: https://docs.google.com/document/d/1isYXXOPe051EWcFQ_f5Gp9ee3-_LZGu5rToZ5eRP5d8

    From that reading, it may well have been a one-off issue with one of the releases between these two versions (where some assets had their GUID or some other meta-data changed), and may also be a quirk of Unity 5 that is no longer relevant. Just posting the information I found, in case it's useful to anyone else. My question about how to handle the upgrade has already been answered.

  • OK - Last post on this, I hope, to provide an update on what I have discovered from experimenting with the two import methods on my local machine. I have resolved all the discrepancies, I think:

    Firstly, as Chris observed, most of the files present via in-place import but not in a fresh import had the suffix 1. I therefore used source-control history to look at the original versions of these files (without the suffix) and saw that none of these were modified from what was in 1.55a version when using the in-place import, but they had been modified in the fresh import.

    In the in-place version, I therefore deleted the original files and renamed the 1 files to remove the suffix and repeated my comparison between the two import methods and could see that the files were now the same (aside from a couple of 'name' attributes which would also need the 1 suffix removed). This therefore fits with the supposition from the previous comment that for some reason Unity was not recognising these as the same assets and was renaming to avoid a naming conflict, rather than importing over the top. I can confirm that, for these files, the GUID is different to what was in 1.55a.

    The only other missing files were the empty 'Manager' directory and associated .meta file. I guess this unused folder was deleted from AC but Unity doesn't have a way of detecting the deletion, so leaves the old file behind.

    This meant that the only remaining differences were in .meta files for directories, presumably because these aren't included in the distribution (just the .meta files for actual files) and are therefore recreated via a fresh import. The only differences were the timeCreated and licenseType fields.

    Hope that helps explain the differences a bit, in case anyone is interested.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.