Search Unity

[Solved] How to import updated PSB file without re-linking all the sprites in Sprite Library Asset?

Discussion in '2D' started by Lim-Leong-Kee, Aug 31, 2021.

  1. Lim-Leong-Kee

    Lim-Leong-Kee

    Joined:
    Mar 29, 2014
    Posts:
    4
    I use PSD Importer to import a PSB file into Unity. I want to make the body parts of a character swappable, so I use Sprite Library and Sprite Resolver to change the sprite for each body part. In the Sprite Library Asset, I link the sprites from the PSB file for each category that can be swapped for each body part.

    But the problem is, if I update anything in the After Effect software and export as a PSB file, then import the PSB file into Unity, it will become a new PSB asset in Unity, then I will need to link all the sprites again from the imported PSB file for each category in the Sprite Library Asset.

    I plan to use C# script to automatically set up the sprites for each category in the Sprite Library Asset instead of manually linking the sprites one by one. I try to use SpriteAtlas so that I can use GetSprite() to automatically get the sprite by name in a new PSB file, but I cannot link the atlas file (the file that contains all the sprites) in the PSB file to the SpriteAtlas.

    How could I access the sprites in the PSB file in C# script?
    Or, is there a better solution to solve the above-mentioned problem so that I do not need to link all the sprites again in the the Sprite Library Asset whenever I re-import an updated PSB file into Unity?

    Thank you.
     
  2. Lim-Leong-Kee

    Lim-Leong-Kee

    Joined:
    Mar 29, 2014
    Posts:
    4
    I thought that I have tried the solution before asking this question but actually I have not yet tried the solution.

    The solution is just to REPLACE the existing PSB file with a new PSB file in Unity and the sprites that match will still remain in the Sprite Library Asset.

    Thanks.
     
  3. Xiangting_Su

    Xiangting_Su

    Unity Technologies

    Joined:
    Sep 22, 2020
    Posts:
    253
    Another way could also be to open the original imported PSB file in After Effects and modify the contents directly so you won't have to reimport it everytime.

    Keeping the "Reslice" option checked in the PSB Importer Inspector helps too. :)
     
    ethanicus and Obay_naeem like this.