Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  3. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

PSD Importer?

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

  1. winryese

    winryese

    Joined:
    May 4, 2016
    Posts:
    17
    Same problem here. preview.4 - 1.2.0. Changing to 8-bit fixed it.
     
  2. JauntyBearGames

    JauntyBearGames

    Joined:
    Mar 26, 2018
    Posts:
    57
    Hi
    Is there any way to update an imported PSB without messing all previous bone geo and weighting setup?
    My use case is I have a rigged character already in place and need to add extra layers in the PSB and eventually add more bones weights etc. I've tried either to update the PSB directly or to import extra sprites but in both cases the existing rigging becomes obsolete. Any idea how to proceed and if there is any plan to support updates?
    Thanks
     
  3. Leo-Yaik

    Leo-Yaik

    Unity Technologies

    Joined:
    Aug 13, 2014
    Posts:
    436
    Hi, which software are you using (i.e. Photoshop or third party like Gimp)?
    Will it be possible to send us the 2 files to check it out?
     
  4. JauntyBearGames

    JauntyBearGames

    Joined:
    Mar 26, 2018
    Posts:
    57
    Hi Leo, the original materials are Pixel layers from Affinity Photo which are exported to PSD; the original materials are quite big so I'll try to mock up a sample thanks
     
  5. Kane_321

    Kane_321

    Joined:
    Aug 6, 2017
    Posts:
    7
    Is there any plans to add UI Images support to this tool? At the moment it makes a prefab using sprite renders, it would be very helpful if it also made a prefab with a canvas and UI Images already set up.

    Or does anyone know how I can extend it so that I can do this?
     
  6. IceTrooper

    IceTrooper

    Joined:
    Jul 19, 2015
    Posts:
    37
    Is it possible to control padding between sprites? It should fit in 512x512, but because of too wide padding it can't. Those green rects should be closer to each other.
    upload_2020-7-22_18-12-55.png

    EDIT: I found solution. PSDImporter.cs: Line 459 (PSDImporter 2.1.4.). Why did you guys hard code padding=4 and didn't expose it in the editor? :/
     
    Last edited: Jul 22, 2020
    EvOne likes this.
  7. TheSafestSafe

    TheSafestSafe

    Joined:
    Jun 25, 2018
    Posts:
    4
    Hi, any update on officially supporting PSD file format with the importer?
    I use krita which can only export in PSD not PSB.
     
  8. thehen2

    thehen2

    Joined:
    Apr 1, 2014
    Posts:
    54
    How can I use the AssetPostprocessor with the PSD Importer? I need to set spritePixelsPerUnit, mipmap settings etc. on import.

    Closest I can get is OnPreprocessAsset, but then I can't change anything.

    Code (CSharp):
    1.     void OnPreprocessAsset()
    2.     {
    3.         PSDImporter psdImporter = assetImporter as PSDImporter;
    4.         ???
    5.     }
     
    nickfourtimes and EvOne like this.
  9. XxPleYxX

    XxPleYxX

    Joined:
    Jul 26, 2011
    Posts:
    41
    If you exceed the maximum size of the atlas (not the file size which is 80 MB) then the console shows the following error:

     
    Last edited: Oct 14, 2020
  10. nachiketanselms

    nachiketanselms

    Joined:
    Dec 22, 2020
    Posts:
    2
    uhhh but i named my psd to "character rig.psb" but it still was of the format of psd.. pls help me i dont have the money for photoshop and i wanna get most out of unity too
     

    Attached Files:

  11. Leo-Yaik

    Leo-Yaik

    Unity Technologies

    Joined:
    Aug 13, 2014
    Posts:
    436
    You can just change the extension to PSB.
     
  12. anyamation

    anyamation

    Joined:
    Jan 9, 2021
    Posts:
    2
    hi im having an issue where unity is not recognizing my .psb file when I go to "import new assets" my .psb files are not showing up only my .psd files are able to be addes?
     
  13. Leo-Yaik

    Leo-Yaik

    Unity Technologies

    Joined:
    Aug 13, 2014
    Posts:
    436
    Do you have the PSDImporter package installed?
     
  14. nickfourtimes

    nickfourtimes

    Joined:
    Oct 13, 2010
    Posts:
    242
    Just going to jump in here and say this is an issue for me as well; I'd like to be able to change the Max Texture Size of an imported .psb file, but right now that's not an option as the
    PSDImporter
    class doesn't seem to have any viable accessors.
     
  15. Leo-Yaik

    Leo-Yaik

    Unity Technologies

    Joined:
    Aug 13, 2014
    Posts:
    436
    nickfourtimes likes this.
  16. Zephus

    Zephus

    Joined:
    May 25, 2015
    Posts:
    361
    Just a general question - why is the package called "PSD importer" when it only imports .psb? Also, if you can just rename the .psd into .psb, shouldn't that take 1-2 lines of code to make the package recognize .psd files as well?
     
    tonytopper likes this.
  17. Leo-Yaik

    Leo-Yaik

    Unity Technologies

    Joined:
    Aug 13, 2014
    Posts:
    436
    This is because the .psd file format is currently being imported by TextureImporter.
    We are looking into hooking up with the new Importer override feature so that users can also use PSDImporter with .psd file.
     
  18. Zephus

    Zephus

    Joined:
    May 25, 2015
    Posts:
    361
    Okay, thank you. I have another question - is the PSD importer the only way to get the Skinning Editor for 2D Animation to show the full sprite? For example let's look at the viking from the samples:


    If I import a sprite sheet the character looks like the on the right. And then I have to use the Skinning Editor and kind of have to guess the right pose before putting it in the Scene. But if I use a .psb then the character shows up like the one on the left. Is there no way to arrange the individual sprites without using .psb?
     
    awsapps likes this.
  19. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    922
    Hello @Zephus
    A .psb file comes with additional data which enables us to "rebuild" the character the same way it is seen in your DCC tool. A .png is a "flat" image file with only the pixel data in it, which doesn't come with the additional data required to reconstruct a character.
     
  20. nickfourtimes

    nickfourtimes

    Joined:
    Oct 13, 2010
    Posts:
    242
    I just noticed that when I switch platforms (PC to console and back again), all the .psb files seem to be getting reimported, despite the fact that I'm using Asset Database v2. My impression was that, with v2, once an asset is imported on a platform, it shouldn't have to be reimported again the next time you switch back to that platform. However, I've been switching back and forth between platforms several times, and the .psbs are always being reimported (which is a very time-consuming process).

    Is this behaviour by design, or a bug?
     
  21. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    922
    Thanks for letting us know @nickfourtimes,
    The Asset Database v2 should store all previously cached platform data which should prevent a full reimport of the assets when switching between platforms. Could you file a bug report so we can take a closer look?
     
  22. Zephus

    Zephus

    Joined:
    May 25, 2015
    Posts:
    361
    Yes, I realize that. I was just wondering if there's a way to manually create a default "build" of the character when using .png files. I feel like that would help a lot, since not everyone wants to use .psb files.
     
  23. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    922
    @Zephus yeah, I think that is a valid point and something we can add to our backlog to research what that might look like. Thanks for the suggestion.
     
  24. nickfourtimes

    nickfourtimes

    Joined:
    Oct 13, 2010
    Posts:
    242
    Filed it, ID 1327701.
     
    Ted_Wikman likes this.
  25. alexlamar

    alexlamar

    Joined:
    Jan 16, 2014
    Posts:
    8
    Hi! This appears to be the general PSD importer feedback thread, but apologies if this should go somewhere else. I'd love it if we had the ability to add an additional amount of padding inside each of the sprites generated in the sprite mosaic. The big use-case here is to have some empty space around each sprite to be colored via shader, e.g. to add an outline that's 3px wide to a sprite. With the sprites being perfectly-bounded at the moment, that's not really possible.

    Is there another way currently to drive how the mosaic is generated? I would love a simple inspector-driven setting for this, but if there is API exposed that can be used to accomplish this, that works too.
     
  26. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    922
    Hello @alexlamar,
    Thank you for the feedback. Posting it here is as good as any place!
    Currently, this API is not available, but we have seen similar feedback in recent times. I will add this to our internal list of feedback, so we can take it into account when planning future PSD Importer improvements.
     
  27. andygeersdt

    andygeersdt

    Joined:
    Jan 18, 2021
    Posts:
    13
    I have the same problem that a few others have mentioned, that I am attempting to import a PSB file with different layers as an animated sprite, but they have a transparent background and once imported are not all the same size. As a result the pivot point roams all over the place and the animation is spoiled. Is there an option that would allow us to get a consistent pivot point, where its position is automatically adjusted to take account of any transparency that is cropped?
     
  28. awsapps

    awsapps

    Joined:
    Jun 15, 2021
    Posts:
    74
    Krita and Gimp doesn't export to .psb natively, only psd. Is there a way to tell PSDimporter to detect .PSD files instead of renaming .psd to .psb extension each time I modify some simple sprite??
     
  29. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    922
    Yes there is @awsapps
    Have a look at this PSD File Importer Override, that you can implement. With this override, you can select per file if the PSD Importer package should import the file, or if the standard TextureImporter should import it.
    Let us know how it goes!
     
    EvOne and awsapps like this.
  30. awsapps

    awsapps

    Joined:
    Jun 15, 2021
    Posts:
    74
    Works like a charm!! Thank you very much, you save me a loooot of my time!!!
     
    Ted_Wikman likes this.
  31. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    922
    Awesome, happy to help!
     
  32. EvOne

    EvOne

    Joined:
    Jan 29, 2016
    Posts:
    173
    Tell me please: -сan these errors occur due to the version of the packages and / or the version of the Unity itself?

    WBR, Alex!

    2021-10-07_11-12-40.png
     
  33. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    922
  34. EvOne

    EvOne

    Joined:
    Jan 29, 2016
    Posts:
    173
    But I already tried this version of the code.
    It issued a mistake:
    2021-10-07_21-42-57.png
    And I even found a branch of the forum where it was discussed:

    https://forum.unity.com/threads/2d-psdimporter-5-0-released-for-unity-2021-1.1107515/#post-7138067

    And there was also a promise to update the documentation :)
    2021-10-07_21-55-17.png

    I did not have this error with obsolete code
    But the button with the choice of Importer - did not appear too

    That is why I decided to check the new version of Override, which You have shown above...

    Upd1: Sorry, sorry, sorry... my fail :oops: Now I see where I was wrong, I continue to try ...

    Up2: Of course, waiting for this button/switch to Import override (as in the new overrider version) - was an mistake!
    -Sorry... - Just did not carefully read the code.

    But the file extension that my Photoshop gives by default - it was the reason for a small detective investigation :D
    2021-10-07_23-47-47.png

    WBR, Alex!
     
    Last edited: Oct 7, 2021
  35. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    922
    @EvOne does it all work now? or are you still experiencing issues?
     
    EvOne likes this.
  36. EvOne

    EvOne

    Joined:
    Jan 29, 2016
    Posts:
    173
    Yes-yes, of course it works now
    - .ToLower() - completely solved this "small problem with large letters" in the extension of the file name... :)
    2021-10-08_10-17-42.png

    Big Thanks!
    WBR, Alex!
     
    Ted_Wikman likes this.
  37. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    922
    Awesome, happy to hear!
     
    EvOne likes this.
  38. prokhorvlg

    prokhorvlg

    Joined:
    Sep 12, 2021
    Posts:
    6
    Hey there! I appear to be experiencing the same issue as some other people on the forum have expressed (such as alexlamar). The auto-generated sprite sheet does not have enough padding between sprites to support an outline shader. Seeing as it has been a few months, I was wondering if it is possible to change the padding in the importer now somehow?
     
  39. Leo-Yaik

    Leo-Yaik

    Unity Technologies

    Joined:
    Aug 13, 2014
    Posts:
    436
    prokhorvlg likes this.
  40. brikim13

    brikim13

    Joined:
    Jul 11, 2020
    Posts:
    4
    Wow this was the answer to my question. One would obviously assume PSD importer will import psd files....
     
  41. sinofeva

    sinofeva

    Joined:
    Nov 8, 2021
    Posts:
    2
  42. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    922
    @sinofeva it helps if you can share more of what issue you are facing. Also, please let us know which version of Unity, 2D Animation and PSD Importer you are using.

    Thanks
     
  43. ChillyRolande

    ChillyRolande

    Joined:
    Apr 20, 2019
    Posts:
    5
    This!!!! Thank you :)
     
  44. MaximPP

    MaximPP

    Joined:
    Jan 26, 2019
    Posts:
    76
    When I import the psd, the sprites don't fit into one 2048 atlas and instead of creating extra sheets, the importer reduces the size of the sprites (v4.3.0 and v6.0.3). Are there plans to support multiple atlases?
     
  45. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    922
    @MaximPP just to clarify, you would like the PSD Importer to create texture pages if the Sprites cannot fit into a single texture? We are looking into this, but I cannot give you an estimate on when we might ship this feature.

    As a workaround, have you tried to increase the max resolution allowed for the PSD file and then pack the generated Sprites using the Sprite Atlas feature, which has your intended max resolution (2048x2048)?
     
  46. MaximPP

    MaximPP

    Joined:
    Jan 26, 2019
    Posts:
    76
    Yes, I would like the Importer to create texture pages, just like Sprite Atlas does now. I have many layers in psd and they don't fit into one sheet 2048*2048

    At first glance it seems that it works, thanks! But I need to test it on different platforms. Won't texture pages be packed twice in APK build? (from PSD Importer and from Sprite Atlases)

    In any case, I will wait for the support of several atlas pages in the PSD Importer, thanks!
     
  47. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    922
    Thanks for confirming, MaximPP.
    No, if a Sprite is part of an Atlas, only the Atlas is packed into the build.
     
  48. MaximPP

    MaximPP

    Joined:
    Jan 26, 2019
    Posts:
    76
    Yes. But in my case I have:
    1) sprites based on psd layers
    2) One 4096*4096 atlas generated with PSD Importer
    3) Three 2048*2048 atlases generated with SpriteAtlases based on files from PSD Importer.

    Sprites (1) will not be included in the build since they are part of the atlases. And what about the intermediate atlas (2). It won't make it into the build either because I regenerated it with SpriteAtlases(3)?

    Screenshot 2022-05-17 at 12.44.13.png
     
  49. MaximPP

    MaximPP

    Joined:
    Jan 26, 2019
    Posts:
    76
    I checked assets with AssetStudio utility, i don't see duplicate atlases 2 and 3. But apk build size increases when i pack psd resources into atlas using SpriteAtlases
     
  50. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    922
    From your image and example, it is not clear to me if all the .psb files Sprites are added to the Sprite Atlas, or only a subgroup is. Could you expand on your current setup?
    Also, could you let me know what kind of memory increase you are seeing? You should be able to see a build report in the Editor.log, so you can see all the different assets being added to the final build.