Search Unity

  1. Click here to see what's on sale for the "Best of Super Sale" on the Asset Store
    Dismiss Notice
  2. We are looking for feedback on the naming of a new user research platform that we are working on.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

PSD Importer?

Discussion in '2D Experimental Preview' started by Aygtets, Dec 2, 2018.

  1. Rich_A

    Rich_A

    Joined:
    Nov 22, 2016
    Posts:
    293
    What are the options for PSD import in 2017.4?
     
  2. Leo-Yaik

    Leo-Yaik

    Unity Technologies

    Joined:
    Aug 13, 2014
    Posts:
    314
    We currently only support PSDImporter for 2018.3 onwards.

    Nonetheless, with ScriptedImporter already available in 2017.4, it is possible to implement your own PSDImporter given our package as base
     
    Rich_A likes this.
  3. giorgos_gs

    giorgos_gs

    Joined:
    Apr 23, 2014
    Posts:
    582
    I use the latest Unity 2019.1.2f1 Windows and when I try to update PSD from Package Manager I get this error:

    Cannot perform upm operation: Unable to add package [com.unity.2d.psdimporter@1.1.0-preview.3]:
    One or more dependencies could not be added to the local file system:
    com.unity.burst: EPERM: operation not permitted, unlink 'F:\TarotReadings_test\Library\PackageCache\com.unity.burst@1.0.0-preview.6\.Runtime\Burst.Backend.dll' [NotFound]
    UnityEditor.EditorApplication:Internal_CallUpdateFunctions()
     
  4. giorgos_gs

    giorgos_gs

    Joined:
    Apr 23, 2014
    Posts:
    582
    installing Burst fixed this.
     
  5. Gronek

    Gronek

    Joined:
    Sep 23, 2017
    Posts:
    2
    Hey!
    I have a problem. I use Krita for creating sprites and after importing the PSD file to unity it opens properly only in sprite editor. I cannot check the Rig Character box as it is not visible anywhere in the inspector. My sprite is slicing properly, and everything looks like it should work, but it doesn't ;(

    The Unity ver that I use is 2018.3.14.f1.

    I've followed the Brackeys tutorial step by step and tried to use another tutorials. Reinstall, reimport, recreating sprite and using PNG doesn't work. I just cannot use the PSB extension in Krita. Should I change the graphics editor to another? It would be sad as this one is the most comfortable to me.

    Kind regards
     
  6. LOGames

    LOGames

    Joined:
    Sep 4, 2016
    Posts:
    19
    @Gronek Have you tried renaming it to .PSB even if Krita won't actually save a PSB? The formats are almost identical so that should usually work.
     
  7. Gronek

    Gronek

    Joined:
    Sep 23, 2017
    Posts:
    2
    daaaaamn it helped :O Thanks a lot! I've seen this tip earlier but just thought it's weird. Sorry :) And thanks! That really helped!
     
  8. RuslanSmirnov

    RuslanSmirnov

    Joined:
    Jun 13, 2019
    Posts:
    5
    i hoped that you will write some library for c++ background. And that be working fast (on gpu, whitout GetPixel()). But now we have wrapper over Paint.NET, which is an so slow if we have 500+ layers in file.

    In fact, this importer same as here: https://github.com/SubjectNerd-Unity/Psd2UnityImporter

    Or am I wrong?
     
  9. EvOne

    EvOne

    Joined:
    Jan 29, 2016
    Posts:
    116
    Will the PSD Importer in the future support named layers in the document?

    Here is a drawing created in the Adobe Illustrator, where in the layers with the assigned names there are grouped non-named "parts" related to this element.
    These names of layers are perfectly understood by Photoshop after exporting from AI to PSD-format.

    But the PSD Importer completely ignores both the names of the layers themselves and the grouping of elements inside the layers - everything will be broken down into separate vector paths and groups, and the names will be lost :(

    PSDImporter_02.mp4_snapshot_00.05_[2019.06.16_21.39.13].jpg
    PSDImporter_02.mp4_snapshot_00.12_[2019.06.16_21.40.14].jpg PSDImporter_02.mp4_snapshot_00.15_[2019.06.16_21.40.27].jpg

    P.S. Sorry for google-translate!
     
    Last edited: Jun 16, 2019
  10. Sam_Ooi

    Sam_Ooi

    Unity Technologies

    Joined:
    Mar 5, 2018
    Posts:
    52
    Hello! The PSD Importer supports importing layers with their names and groupings intact, but it may have issue with the vector and path elements from Adobe Illustrator.

    Just a few questions:

    1. Currently, only the .PSB format is supported with the PSD Importer. You said you converted the .AI file to a .psd file. Have you tried to save it and import it as a .psb file?

    2. Could you attach the original .AI file you created for us to check?

    Thank you!
     
  11. EvOne

    EvOne

    Joined:
    Jan 29, 2016
    Posts:
    116
    Hello!

    Export from the illustrator in my version is possible only in PSD,
    2019-06-20_10-09-57.png
    options for the export in the screenshot. Then I just renamed the file extension to .psb.
    2019-06-20_10-17-24.png
    I also imported saved from AI psd-file into Photoshop (which saw all the named layers), and then saved it in PSB format.
    2019-06-20_10-25-32.png

    But after importing into a Unity, I don’t see any difference between the two assets.
    2019-06-20_10-42-52.png

    Original AI file in attached zip

    With best regards,
    Alex
     

    Attached Files:

  12. Sam_Ooi

    Sam_Ooi

    Unity Technologies

    Joined:
    Mar 5, 2018
    Posts:
    52
    Hi, in this screenshot, you did not set the PSDImporter to keep Layer Grouping. Click the checkbox next to 'Use Layer Grouping' in the PSD Importer settings, and then click Apply. Then drag your character into the Scene again. You should see it with its layers in the correct grouping.

    Could you let me know if that helps?
     
    EvOne likes this.
  13. EvOne

    EvOne

    Joined:
    Jan 29, 2016
    Posts:
    116
    I'm sorry...
    double-facepalm-cropped.jpg
    How did I miss such an obvious reason for this "problem"...
    -Once again - excuse me ...
    1-107-128.png

    P.S. I revised my early sources - I put this checkbox! :)
    but then I did not have named layers, so there were still groups and paths, so I remembered this...
    But now... Oooh... Sorry...

    Everything is ok now :)
    2019-06-20_18-13-26.png
     
    Sam_Ooi likes this.
  14. Sam_Ooi

    Sam_Ooi

    Unity Technologies

    Joined:
    Mar 5, 2018
    Posts:
    52
    Ha ha, no worries. Glad that everything is working fine now :)
     
    EvOne likes this.
  15. RedOrAlive

    RedOrAlive

    Joined:
    Feb 5, 2019
    Posts:
    2
    I'm trying to us this library, and I've noticed that I am unable to build for iOS once I import the package. Thinking it might be an issue with my project, I created a brand new clean one, installed the package and even before importing a PSB I try to build to iOS and it presents me with 6 errors, was wondering if anyone else was experiencing this? Looks like the burst lib is whats throwing them.
     
  16. RedOrAlive

    RedOrAlive

    Joined:
    Feb 5, 2019
    Posts:
    2
    In true developer fashion, the minute I asked for help I resolved the issue. If anyone else has this problem, first make sure your XCode Command Line tools are set to point at the latest version (XCode > Preferences > Location) then you need to update the Burst library in Unity to match the same preview version that the PSD Importer is using - preview3 1.1.0 in my case.
     
    SlimeProphet likes this.
  17. nitrofurano

    nitrofurano

    Joined:
    Jun 7, 2019
    Posts:
    92
    besides psd, would be great having xcf import as well
     
    mcroswell likes this.
  18. EvOne

    EvOne

    Joined:
    Jan 29, 2016
    Posts:
    116
    I apologize for repeating my message in another thread of the forum, but there is still no answer.
    And maybe I just asked a question in the wrong place... :rolleyes:
    ---
    Could you please tell if it is possible now, and if so, - how can you "update" the graphics already imported by the PSDImporter to its newer version?
    Since I have never found any mention of how to do this often required process, I tried to simply change the PSB-file to a new version outside of Unity - in the Windows explorer... :rolleyes:

    But despite the fact that the Rig with the bones, the binding and the weights is preserved, the result was not successful...
    In my opinion, the structure of the layers and their names have not changed in the imported file, the dimensions of the picture also did not change (I watched it),
    but the PSD Importer, even in the form of an atlas shows a completely different picture.
    And of course, on the scene, the fully working prefab of the character was completely broken :(
    A similar substitution for the old PSB file did not help...

    -it seems that even the slightest change in the structure of the layers in the psb file, and even the addition of a new group of drawn objects inside previously imported named objects - causes catastrophic changes during import.
    Is it possible to change this in future versions?

    I understand that the method I used to update the graphics is slightly "hacker" :D
    but how can I do it in a regular way?

    P.S. Sorry for Google-translate
     
  19. Leo-Yaik

    Leo-Yaik

    Unity Technologies

    Joined:
    Aug 13, 2014
    Posts:
    314
    @EvOne which package version are you using?
     
    EvOne likes this.
  20. EvOne

    EvOne

    Joined:
    Jan 29, 2016
    Posts:
    116
    Only this is available to me:
    2019-07-24_17-13-36.png
    Are there already newer versions?
    -If this is so - I can not even find out about it - the package manager does not show future versions :(

    Unity 2019.3.0a8 and newer -I can not install because of a bug with a crash when running under Win7
    so I had to stop at a7
    and 2019.2.0b7 is stable (for me) working beta. Newer versions 19.2 - I have not yet installed.
     
  21. MikaMobile

    MikaMobile

    Joined:
    Jan 29, 2009
    Posts:
    844
    In my experience, you can make changes to a PSB and not totally ruin your rig, but there are a couple quirks right now.

    The one I keep bumping into is when you do a simple change that doesn’t effect the geometry at all, like changing a layer’s color. This should be fine, but I find that it temporarily breaks instances of the PSB that are inside prefabs: the bones all become invisible and stop working. The “fix” for me has been to simply open the effected prefab and close it again. (By the way, I reported this bug with clear repro steps but it came back as unable to repro?)

    Another issue I’ve found is when changing a layer in a way that makes it a different size than it used to be - the existing bounding box around that sprite in the atlas has to be manually changed, and the geometry for that layer has to be regenerated in the skinning editor and any weights redone as well.
     
  22. sergebat

    sergebat

    Joined:
    Nov 22, 2015
    Posts:
    6
    This is extremely useful piece of advice! It indeed worked for me for the PSDs saved in Affinity Designer!

    Can someone knowledgeable of Unity PSD importer internals comment on the reliability of this hack going forward? :) If it works now on some PSD renamed to PSB is it likely to break in future versions on the Unity/Importer? Are there particular caveats and format differences to watch for (like maybe we are safe if we only use rasterized layers)? What is the motivation behind supporting less common PSB format in the first place? Thanks in advance! :)
     
  23. Leo-Yaik

    Leo-Yaik

    Unity Technologies

    Joined:
    Aug 13, 2014
    Posts:
    314
    PSB is a Photoshop file format similar to PSD file except it supports larger file size.

    The reason we are using the PSB format is because of Unity Importer's constraint where only 1 file extension can be imported by 1 importer and the PSD extension is currently taken by the TextureImporter.

    Moving forward, works are in place to allow PSD extension to be imported by other importers (including ScriptedImporters). The current PSDImporter will also continue to support both PSB and PSD file extension.
     
  24. giorgos_gs

    giorgos_gs

    Joined:
    Apr 23, 2014
    Posts:
    582
    I recently tried updating my app from 2019.1.10 to 2019.2.4f1 and all my PSB prefabs broke. All the project become unusable. I have over 80 PSBs and I got these warning messages:

    Code (CSharp):
    1. Identifier uniqueness violation: 'Name:new_style33 (Missing Prefab), Type:Prefab'. Multiple Objects with the same name/type are generated by this Importer. There is no guarantee that subsequent imports of this asset will properly re-link to these targets.
    I dont have multiple objects with the same name.
    Deleting the Library folder to re-import does the same outcome.

    Your asap help is appreciated.
     
  25. Leo-Yaik

    Leo-Yaik

    Unity Technologies

    Joined:
    Aug 13, 2014
    Posts:
    314
    Can you send a sample project before upgrading for me to take a look?
    You can PM me with a link where I can download and look at the repro case
     
    Last edited: Sep 16, 2019
  26. giorgos_gs

    giorgos_gs

    Joined:
    Apr 23, 2014
    Posts:
    582
    Done. I took out the Library folder because its huge! Do you need it?
     
  27. EvOne

    EvOne

    Joined:
    Jan 29, 2016
    Posts:
    116
    Please explain what was meant in the section: "Character Rig" of the documentation for the Importer:

    "If the Sprite contains bone and skin data, the Sprite Skin component is added as well."
    -I can not understand in what case the imported sprite can contain information about bones and skin... :oops:
    Аnd what in this case generally means "skin"?
     
  28. modgle

    modgle

    Joined:
    Sep 24, 2019
    Posts:
    3
    Hi. Is there any way to change the way of packing sprites in atlas? Random reshuffle maybe? Right now it generates HUGE transparent areas and that's bad for mobiles.
     
  29. Leo-Yaik

    Leo-Yaik

    Unity Technologies

    Joined:
    Aug 13, 2014
    Posts:
    314
    This means when the Sprite that is generated contains bone and weight skinning data. In this particular case, the bone and weight skinning data comes will come from using the Skinning Module in Sprite Editor Window.

    'Skin data' refers to how the Sprite mesh is weighted on a bone
     
    EvOne likes this.
  30. Leo-Yaik

    Leo-Yaik

    Unity Technologies

    Joined:
    Aug 13, 2014
    Posts:
    314
    Do you mean the atlas image that is generated from the PSDImporter?
     
  31. EvOne

    EvOne

    Joined:
    Jan 29, 2016
    Posts:
    116
    Forgive me with my "language barrier" sometimes there are problems.
    -In most cases, I understand everything (almost everything, ok :D) written in English, but sometimes,
    right now - I read, re-read, but it doesn’t become clearer...
    The "logical chain" simply does not add up at all, maybe the language barrier has nothing to do with it,
    and I just ask a little wrong question :oops:
    Judging by what you wrote:

    "This means when the Sprite that is generated contains bone and weight skinning data."

    - I see (corrected for "my Russian English") that it seems that the situation is meant when this information was already generated by Skinning Module and then we may decide - include Character Rig based on this information into asset or not include?

    Once again, I'm sorry, I'm just confused ...

    Probably the additional question I needed to ask sounds something like this:
    In which case the generated sprite can contain this information - Is it using information from the file in PSD format itself (layers == meshes)
    or is it all only after the Skinning Module from Sprite Editor?

    All this does not interfere with the work with the Package! -Everything in it works great! :)
    I just want to clarify, with a seemingly simple :( checkbox in the settings...

    Skin date - Ah! Ok, so I’m right that this is service information not related to the “skins” in the gamers meaning of this word :)

    P.S. Sorry for Google translate... (In Russian -> English direction - I can only translate in this way :oops:)
     
    Last edited: Nov 11, 2019
  32. Leo-Yaik

    Leo-Yaik

    Unity Technologies

    Joined:
    Aug 13, 2014
    Posts:
    314
    To simplify the case, it is the Skinning Module.

    I understand your confusion in this matter and we will try to make the documentation clearer as we go along. Thanks!
     
    EvOne likes this.
  33. modgle

    modgle

    Joined:
    Sep 24, 2019
    Posts:
    3
    Yes.
     
  34. Leo-Yaik

    Leo-Yaik

    Unity Technologies

    Joined:
    Aug 13, 2014
    Posts:
    314
    Not as this moment unfortunately. However, you can pack the Sprites that are generated from the PSDImporter into another Atlas by using our SpriteAtlas and that should give you a better packing fit.
     
  35. christianmahler

    christianmahler

    Joined:
    Jul 9, 2017
    Posts:
    32
    Are there plans to make 2D Animation also compatible with the Affinity Stack, like an .afdesign importer?
     
  36. Leo-Yaik

    Leo-Yaik

    Unity Technologies

    Joined:
    Aug 13, 2014
    Posts:
    314
    Not at the moment I am afraid If the demand for such an importer is high enough, we will take that into consideration in our next product planning. Thanks for letting us know!
     
  37. josessito

    josessito

    Joined:
    Feb 14, 2014
    Posts:
    56
    Hi, Is there a way you support secondary textures (norml maps) with the psd importer package? Is there currently a workaround for this? I've been trying to use the skeletal animation with 2D lights and can't make it happen. Thank you!
     
  38. Leo-Yaik

    Leo-Yaik

    Unity Technologies

    Joined:
    Aug 13, 2014
    Posts:
    314
    It should be possible using the same workflow as a PNG. Though for this to work, your normal map texture for the PSD(PSB) needs to have the same layer and size so that when it mosaic the file, it will give you the same layout
     
  39. LeleUnity

    LeleUnity

    Joined:
    Jul 30, 2016
    Posts:
    94
    My PSB file shows this structure inside UNITY in the project view:
    -Character
    ---->ARM
    ---->LEG
    ---->TORSO
    BUT IS NOT ALIGNED TO WHAT IS PHOTOSHOP! ( where is instead LEG,ARM,TORSO)
    if I open it in photoshop it shows a different order.

    It seems the order is respected in Unity only in Sprite sorting Layers but NOT in the object's structure.

    How can I force UNITY to have the object structure like the PSB file in photoshop?

    I KEEP changing the layers order in photoshop but The object structure doesn't change at all !
     

    Attached Files:

  40. Leo-Yaik

    Leo-Yaik

    Unity Technologies

    Joined:
    Aug 13, 2014
    Posts:
    314
    Yes, that's the case for now. We will make a fix for this soon
     
  41. ChefBaas

    ChefBaas

    Joined:
    Jul 25, 2018
    Posts:
    2
    Hi,

    we were using the 2D PSD Importer package 1.0.0-preview.3 on Unity 2018.4.17f1 and updated to 1.0.0-preview.4 at some point. It seems this has caused all of our PSBs' SpriteRenderers to have lost the correct path to their sprites. In our version control we can see that the metadata's 'fileIDToRecycleName' has been changed We found this changelog, which says that prefab instances will be broken when upgrading to 1.0.0-preview.4 from earlier versions (which we suspect is happening to our project). I also posted about this on Unity Answers here.
    We would like to update our Unity project and packages to newer versions, but we are afraid that this will break prefab instances again. Any advice on what to do?
     
  42. madhavofficial

    madhavofficial

    Joined:
    Jan 22, 2020
    Posts:
    1
    Have you gone through Advanced -> Show Preview Packages in the Package Manager. Looks like that bit was missed in the video.
     
  43. Leo-Yaik

    Leo-Yaik

    Unity Technologies

    Joined:
    Aug 13, 2014
    Posts:
    314
    This is due to a bug where the referencing name was wrong. To fix this, you will need to tinker around with the meta files.

    If upgrading to the latest breaks prefab reference for you, you can share the project with me and I can help you fix up the meta files.
     
  44. jason_yak

    jason_yak

    Joined:
    Aug 25, 2016
    Posts:
    344
    Hi there, we've been evaluating the PSD importer, if we have Pivot set to Center it works great for individual sprites but when toggling on “Use Layer Grouping” is there anyway to make the Group Parent pivot Center based on it’s children as opposed to just setting the Group Parents pivot to be center of the whole PSD? it's kind of making groups unusable for us. Thanks =)
     
  45. Leo-Yaik

    Leo-Yaik

    Unity Technologies

    Joined:
    Aug 13, 2014
    Posts:
    314
    Sounds logical. Let us take a look
     
    jason_yak likes this.
  46. jacsu246

    jacsu246

    Joined:
    Apr 28, 2020
    Posts:
    1
    I google the issue below, that I had while importing my .psb file from photoshop and this seemed to be the only remotely relatable thread.

    So if you encounter the problem below. Convert your image from 32bit/16bit color to 8bit color.
    I hope that helps someone :)

    IndexOutOfRangeException: Index was outside the bounds of the array.
    PhotoshopFile.Compression.ZipPredict32Image.Unpredict (System.Byte[] ptrData, System.Byte[] ptrOutput) (at Library/PackageCache/com.unity.2d.psdimporter@1.0.0-preview.4/Editor/PSDPlugin/PsdFile/Compression/ZipPredict32Image.cs:175)
    PhotoshopFile.Compression.ZipPredict32Image.Read (System.Byte[] buffer) (at Library/PackageCache/com.unity.2d.psdimporter@1.0.0-preview.4/Editor/PSDPlugin/PsdFile/Compression/ZipPredict32Image.cs:51)
    PhotoshopFile.Channel.DecodeImageData () (at Library/PackageCache/com.unity.2d.psdimporter@1.0.0-preview.4/Editor/PSDPlugin/PsdFile/Layers/Channel.cs:243)
    PhotoshopFile.PsdFile.DecompressImages () (at Library/PackageCache/com.unity.2d.psdimporter@1.0.0-preview.4/Editor/PSDPlugin/PsdFile/PsdFile.cs:574)
    PhotoshopFile.PsdFile.Load (System.IO.Stream stream, PhotoshopFile.LoadContext loadContext, PhotoshopFile.ELoadFlag loadFlag) (at Library/PackageCache/com.unity.2d.psdimporter@1.0.0-preview.4/Editor/PSDPlugin/PsdFile/PsdFile.cs:110)
    PhotoshopFile.PsdFile..ctor (System.IO.Stream stream, PhotoshopFile.LoadContext loadContext, PhotoshopFile.ELoadFlag loadFlag) (at Library/PackageCache/com.unity.2d.psdimporter@1.0.0-preview.4/Editor/PSDPlugin/PsdFile/PsdFile.cs:84)
    PaintDotNet.Data.PhotoshopFileType.PsdLoad.Load (System.IO.Stream input) (at Library/PackageCache/com.unity.2d.psdimporter@1.0.0-preview.4/Editor/PSDPlugin/PhotoShopFileType/PsdLoad.cs:38)
    UnityEditor.Experimental.U2D.PSD.PSDImporter.OnImportAsset (UnityEditor.Experimental.AssetImporters.AssetImportContext ctx) (at Library/PackageCache/com.unity.2d.psdimporter@1.0.0-preview.4/Editor/PSDImporter.cs:178)
    UnityEditor.Experimental.AssetImporters.ScriptedImporter.GenerateAssetData (UnityEditor.Experimental.AssetImporters.AssetImportContext ctx) (at C:/buildslave/unity/build/Modules/AssetPipelineEditor/Public/ScriptedImporter.cs:20)
    UnityEditorInternal.InternalEditorUtility:projectWindowDrag(HierarchyProperty, Boolean)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)
     
  47. Leo-Yaik

    Leo-Yaik

    Unity Technologies

    Joined:
    Aug 13, 2014
    Posts:
    314
    Which version of PSDImporter did you encounter this issue?
     
  48. EvOne

    EvOne

    Joined:
    Jan 29, 2016
    Posts:
    116
    New Version! Wow! :)

    Big Thanks!

    ---
    Fixed
    Fix PSD import issues with PSD file without unique layer id

    ---
    maybe I'm lucky with files exported from Illustrator :rolleyes:

    But... Is everything ok with version numbering and release dates?
    2020-05-07_10-29-33.png 2020-05-07_10-31-52.png
     
  49. christianmahler

    christianmahler

    Joined:
    Jul 9, 2017
    Posts:
    32
    I just upgraded my project from 2019.2 to 2019.3 and since then a .psb file that could previously be imported now delivers an exception and cannot be imported (with the same PSD Importer version 2.1.4).

    Anyone any idea why this happens in 2019.3 and how to fix this?

    Edit: There was an inactive layer in the document, I removed it and now the import works. Question is why does this work in 2018.2 and not in 2019.3.
     
    Last edited: May 22, 2020
  50. Leo-Yaik

    Leo-Yaik

    Unity Technologies

    Joined:
    Aug 13, 2014
    Posts:
    314
    Can you send us the file to look at?
     
unityunity