PSDImporter API Request

Hi,

We have seen several requests to have API access for the PSDImporter. We are looking at adding support for this.

We would like to hear from you what APIs would like to have for the PSDImporter and how you will be using them.

On our project, weā€™d like to be able to at least change the maxTextureSize of the generated sprite.

1 Like

Iā€™d really like to hook into the API to get associated GameObjects and SpriteRenderers for the sprites that get imported.

Iā€™ve been trying to use OnPostprocessSprites, or any AssetPostprocessor really. Tracking down these objects from there has not been working and trying to figure it out has been a bigger time sink than Iā€™d like.

For now, what I am trying to do is set the sorting layer of the SpriteRenderer.

I could see myself trying to use this to do some auto-rigging potentially and also adding some custom recoloring components to certain sprites. Or maybe even some deforming to get say a piece of clothing to overlay more perfectly.

1 Like

Hello, I need methods to quickly change setting by platform, something like the TextureImporter

var androidSettings = importer.GetPlatformTextureSettings("Android");
// .........
// Change settings such as max resolution, format, compression quality etc
// ...........
importer.SetPlatformTextureSettings(androidSettings)

Thank you

1 Like

Also, working on clothing and layering and finding myself looking for the most efficient and performant way to do this. Not sure UnityEngine.U2D.Animation and PSDImporter APIs currently make this easy. In fact, it is looking to be very much harder than I anticipated.

Being able to iterate is important to prototyping.

Iā€™d like to be able to play around with ā€œOrder in Layerā€. I can probably just do this with a naming convention, but it would be nice to have other options. Right now the Importer just stacks the sprites one on top of another, leaving no room to slide other things in

As well, trying to figure out how a piece of clothingā€™s sprite sheet/rig can be layered over and attached to another underlying rig. Essentially, we need to be able to weave multiple rigs together dynamically.

Setting individual sprite pivots points using SpriteAlignment: Unity - Scripting API: SpriteAlignment

1 Like

I need an option in order to set sprites to the same size of the PSD file, and arranged as a tilemap in spritesheet.
and need some APIs to set each spriteā€™s pivot whatever they are rigged or not.
Thanks

Hi, do you mean by you want to control where to place the layerā€™s rasterized data on a specific location of the texture?

yes, and customize their pivots.
currently itā€™s not easy to use a psd file as a 2d frame animation source file (each layer or group as a frame).

Thanks for the feedback; keep them coming!

Iā€™m looking for a way to read pixel values from the resulting sprite sheet from within an EditorWindow. Iā€™m writing a tool to that exposes the colors used in the sprites created from the PCB at editor time so that you can specify what colors to replace them at runtime. The tool then writes a texture that is used with a custom shader at runtime to do a palette swap.

I can access the Texture2D via AssetDatabase.LoadAssetAtPath but it isnā€™t write enabled. I tried to modify its TextureImporter via AssetImporter.GetAtPath but that returns null.

Update: I am a fool and now see there is an advanced setting on the importer to make the texture read/write enabled. Sorry!

1 Like

https://github.com/realamex/PSDImporterForFrames
I made it, I believe you guys can do better.

Hi! Would it be possible to:

  • be able to tick which layers you want and which you donā€™t (our art team uses smart objects but those get translated to several duplicate sprites when imported through the tool)

  • I realized that this may be possible on higher versions (7+) but Iā€™m bound to 2021 for now so having this ability there would be nice

  • OR allowing us to remove sprites from the auto-generated sprite sheet

  • (Even better) support smart objects being always translated to the same sprite

  • Allow us control to hijack the process of process the psb file and choosing if we want a sprite renderer hierarchy or a uGUI one (using spriteRenderers OR using ImgComponent with the sprite properly set and the layout still being recreated) ā† this would be the best feature for next releases imho

Cheers and keep up the good work!

2 Likes

Great suggestions, @NunoEM
Iā€™ve added them to our list of feedback items so that we can take it into consideration for future PSD Importer improvements.

For anyone who interesting, You can change the psb file settings like below;

       PSDImporter textureImporter = PSDImporter.GetAtPath("Assets/Images/player/player.psb") as PSDImporter;

        if (textureImporter != null)
        {
            TextureImporterPlatformSettings tip = new TextureImporterPlatformSettings();
            tip.maxTextureSize = 512;
            textureImporter.SetImporterPlatformSettings(tip);
            textureImporter.SaveAndReimport();
        }
3 Likes