Search Unity

  1. Calling all beginners! Join the FPS Beginners Mods Challenge until December 13.
    Dismiss Notice
  2. It's Cyber Week at the Asset Store!
    Dismiss Notice

Unity5 and custom packages imports

Discussion in 'Editor & General Support' started by booyah, Mar 18, 2015.

  1. booyah

    booyah

    Joined:
    Mar 5, 2013
    Posts:
    215
    Hello there,

    Since the 5.0 update, I noticed importing a unitypackage containing a different version of the same files than already present in one's project will cause a rename-and-keep-both type of behaviour whereas it used to follow the replace behaviour.

    This is causing us massive headaches when dealing with replacements when updating packages with newer versions of the same assets. Even just asking the user for what he wishes to do with the files on import would be grand.

    I filed a bug report (case 661955) back when I spotted the issue with 5.0.0b18 but got no answer whatsoever, so I'm trying here in case someone might see it.

    Cheers,
     
    LotusBlack and Teku-Studios like this.
  2. Teku-Studios

    Teku-Studios

    Joined:
    Sep 29, 2012
    Posts:
    257
    This seems like quite a big issue. We are planning to Upgrade to Unity 5 and we have a lot of packages from the asset store, so it would be nice to see this problem fixed before migrating.
     
  3. Carpe-Denius

    Carpe-Denius

    Joined:
    May 17, 2013
    Posts:
    805
    Did you update to 5.0.whateveristhemostrecentone?

    I imported several packages since 5.0 beta 7 or so (the last one yesterday) and I always got the screen where I could see what was new. I never got something renamed.
     
  4. booyah

    booyah

    Joined:
    Mar 5, 2013
    Posts:
    215
    @Carpe Denius : Yeah I'm on the latest public release 5.0.0f4, the one that got released earlier this month.
    I do get the screen listing the changed files, the renaming happens silently (!!!) afterwards.

    @Teku Studios : I'd have to test with asset store packages, I've only tried with custom packages so far, but I think it's the same process behind the scenes.

    Also, it would seem this happens only with binary files such as assemblies and images and so forth.
     
    Teku-Studios likes this.
  5. booyah

    booyah

    Joined:
    Mar 5, 2013
    Posts:
    215
    Ok, I just took a look at the Unity5 upgrade guide to see if I missed something and I indeed did.
    In the misc. chapter, at the bottom : "Packages with file names that already exist in the project, but with different GUIDs will have these files imported with a unique file name. This is done to prevent overriding files in the project that actually came from different packages or were created by the user."

    It wasn't only binary files, just files which guid changed for some reason.

    So it's not a bug, it's a feature. What it means is if the resource's guid changed somehow, you're basically screwed. :(
     
    Teku-Studios likes this.
  6. booyah

    booyah

    Joined:
    Mar 5, 2013
    Posts:
    215
    @Teku Studios : I just tested with our package : PopcornFx Desktop Plugin. We have 2 versions up on the Asset Store, a Unity4.X and a Unity5 version.
    I imported the former in Unity 4.6 and updated to the latter in Unity5 and everything got silently renamed, effectively breaking the update process in our case...
     
  7. Teku-Studios

    Teku-Studios

    Joined:
    Sep 29, 2012
    Posts:
    257
    That's weird, one would expect a much more unified process for these things...
     
    Last edited: Mar 19, 2015
  8. booyah

    booyah

    Joined:
    Mar 5, 2013
    Posts:
    215
    Bumping, still nothing from Unity. :(
     
  9. Teku-Studios

    Teku-Studios

    Joined:
    Sep 29, 2012
    Posts:
    257
    Have you tried to posting this as a Feedback ticket as well? Maybe they would take a look to the issue there.
     
  10. booyah

    booyah

    Joined:
    Mar 5, 2013
    Posts:
    215
    Last edited: Mar 25, 2015
    Teku-Studios likes this.
  11. Teku-Studios

    Teku-Studios

    Joined:
    Sep 29, 2012
    Posts:
    257
    I do not have enough votes, but as soon as I get them back I'll vote for it :)
     
    booyah likes this.
  12. Teku-Studios

    Teku-Studios

    Joined:
    Sep 29, 2012
    Posts:
    257
    There, I gave you all my votes and a comment, hoping that the Feedback ticket gets some attention.

    (You should definitely try some people to comment there so it gets to the top of the Active threads list).
     
    booyah likes this.
  13. booyah

    booyah

    Joined:
    Mar 5, 2013
    Posts:
    215
  14. Denvery

    Denvery

    Joined:
    Mar 26, 2014
    Posts:
    17
    Sorry, where is this doc? can you put the link please?
     
  15. Carpe-Denius

    Carpe-Denius

    Joined:
    May 17, 2013
    Posts:
    805
  16. Denvery

    Denvery

    Joined:
    Mar 26, 2014
    Posts:
    17
  17. Denvery

    Denvery

    Joined:
    Mar 26, 2014
    Posts:
    17
    So, as I understand, we can't switch this feature off?
    And
    Dear Community,
    how do you think, what I should do, if I need to import package to replace files? May be, make GUID identical, if it's possible...?
     
  18. Carpe-Denius

    Carpe-Denius

    Joined:
    May 17, 2013
    Posts:
    805
    Just delete the old one before you import the new one
     
  19. Denvery

    Denvery

    Joined:
    Mar 26, 2014
    Posts:
    17
    Thanks!

    I've found a way to make GUIDs identical. Meta-files need to stay identical for file that will be replaced and replacing file.
     
  20. booyah

    booyah

    Joined:
    Mar 5, 2013
    Posts:
    215
    @Denvery : Yes, also do the replace while Unity's not running as I think it detects changes and updates the meta file with a new GUID.
     
  21. LotusBlack

    LotusBlack

    Joined:
    Apr 9, 2015
    Posts:
    35
    Bump, cause this is basically unbelievable.

    This "feature" basically breaks a much more important "feature": updating plug-ins from the Asset Store. For one reason or another your GUIDs WILL be changed if you use version control, so when you update your plug-ins everything goes to hell.

    Classic case of a program trying to "fix" user-land mistakes that the USER should be responsible for.
    Baby Linus cries a little.
     
    tosiabunio and booyah like this.
  22. Sekai92

    Sekai92

    Joined:
    Apr 22, 2015
    Posts:
    32
    @Denvery @Carpe Denius is that ok if i'm deleting the old one (same file name) before i import the update the new one and make it as a Assetbundles?
    Because after i import the new one the GUID in meta-file different

    My New Files:
    fileFormatVersion: 2
    guid: dfcf7b1079d1441898bc0fe65b7ce00a

    My Old Vers:
    fileFormatVersion: 2
    guid: b9eb94cf7c954b33a9562133d8261879
     
    Last edited: Jun 22, 2015
  23. Carpe-Denius

    Carpe-Denius

    Joined:
    May 17, 2013
    Posts:
    805
    I have never changed the guid, so I can't tell you that, sorry. I just move the folder back to the assets root folder and let unity overwrite them.
     
  24. Sekai92

    Sekai92

    Joined:
    Apr 22, 2015
    Posts:
    32
    what unity version are you using sir? I'm using Unity 5.0.3f2
     
  25. Carpe-Denius

    Carpe-Denius

    Joined:
    May 17, 2013
    Posts:
    805
    5.1.1something. But I did the same with 5.0.x
     
  26. shadiradio

    shadiradio

    Joined:
    Jun 22, 2013
    Posts:
    75
    Deleting files before updating is not really a solution, because that can break dependencies you have between prefabs and references to some scripts in plugins (for example). I really wish I could just replace files when updating plugins, like in Unity 4.x.
     
  27. Denvery

    Denvery

    Joined:
    Mar 26, 2014
    Posts:
    17
    You need delete old ones, but only IN FILESYSTEM, not in Unity editor. In this case (filesystem) meta-files remains corrected, but content files replaced as we need.
     
  28. Carpe-Denius

    Carpe-Denius

    Joined:
    May 17, 2013
    Posts:
    805
    I don't know what you did, I updated several plugins in the last weeks and everytime the old files got overwritten. I had no problems with that.
     
  29. Sekai92

    Sekai92

    Joined:
    Apr 22, 2015
    Posts:
    32
    only IN FILESYSTEM? what do you mean IN FILESYSTEM? Explore? Project panel? Hierarchy panel?
    Can you give us screenshot?

    Because I'm deleting old asset on Unity Editor Project panel, then import the new asset again. I try delete old asset (i dont delete the old asset meta files) on Explore but when i open up my Unity Editor and import the new asset again, the meta files keep change to the new one
     
  30. booyah

    booyah

    Joined:
    Mar 5, 2013
    Posts:
    215
    He means you need to do the replacement in the windows explorer (finder on mac osx) while Unity is not running to prevent it from updating the asset database.

    So I guess you need to import the new assets in an empty project, quit Unity and manually replace the files from the empty project to the actual working project.
    Edit : Also, discard any meta file!
     
  31. booyah

    booyah

    Joined:
    Mar 5, 2013
    Posts:
    215
    Sekai92 likes this.
  32. Sekai92

    Sekai92

    Joined:
    Apr 22, 2015
    Posts:
    32
  33. thieum

    thieum

    Joined:
    Apr 8, 2011
    Posts:
    51
    Thanks for the thread, you (almost) solved my issue...
    Amazing drop in my workflow, too. Package updates or file replacement give me headaches, not only because of the duplicates but also of the "missing references".

    Upgrading my project from 4.6 to 5 was really a struggle, whereas it has always been a great excitment from 2.6 to 4.6.
    Keep up the good work, Unity folks, and take care of your loving users!
     
  34. j-robichaud

    j-robichaud

    Joined:
    Aug 26, 2010
    Posts:
    40
    I had an issue with compiled DLL but I managed to find a workaround. I hope it helps anyone.

    What i was doing :
    1. Generate DLL
      1. Call EditorApplication.LockReloadAssemblies();
      2. Compile source code into a DLL in the project
      3. Create Asset Package with DLL
      4. Delete DLL
      5. Call EditorApplication.UnlockReloadAssemblies()
    What i am doing now:
    1. Setup (once per DLL)
      1. Generate a dummy DLL with a dummy internal class
      2. Make sure the DLL has the good GUID
    2. Generate DLL
      1. Create a backup of the dummy DLL outside of unity
      2. Call EditorApplication.LockReloadAssemblies();
      3. Compile source code into a DLL in the project overriding the dummy dll
      4. Generate DLL over the dummy DLL
      5. Create Asset Package with DLL
      6. Put back dummy assembly
      7. Call EditorApplication.UnlockReloadAssemblies() (Make sure it is in the finally of a try catch, failing to call this mostly break your project)