2D PSD Importer 6.0 released for Unity 2021.2

2D PSD Importer 6.0 released for Unity 2021.2

We’re happy to share that we’ve released 2D PSD Importer 6.0 for Unity 2021.2. This release is focused on layer management and mapping to improve the workflows from Photoshop and other image-editing tools into Unity.

What’s new?

  • Added the ability to map SpriteRects to the layer name in a Photoshop file instead of using layer ids. More on this below.
  • Provided an automatic custom Physics shape generation option in the importer.
  • Added support to collapse the layers in a Photoshop file’s Layer Group. This enables a workflow where multiple layers of art in Photoshop can generate a single Sprite in Unity. It’s no longer necessary to merge the layers in Photoshop.
  • Added the ability to configure Mosaic Padding to give users control over the space between each generated Sprite in a Texture.
  • Improved PSDImporter Inspector usability.

More about layer names vs. layer ID
The PSDImporter uses an ID that is stored internally by Photoshop for each layer to identify the mapping of the layer to the Sprite that was generated. Many third-party software that produce Photoshop Image files do not store the ID value resulting in potential data loss. In PSDImporter 6.0, users can have the option of using a Layer’s name to map to the Sprite it generates.

See the full 2D PSD Importer 6.0 changelog here.

About 2D PSD Importer
The 2D PSD Importer is an Asset importer that imports Adobe Photoshop .psb files into Unity, and generates a Prefab of Sprites based on the imported source file.
Read more in the 2D PSD Importer documentation.

Getting Started

  • Install the latest Unity 2021.2
  • Start a new project with the 2D or 2D URP Template

You can confirm that the 2D PSD Importer 6.0 package is installed by opening Package Manager (Window > Package Manager) and selecting the Packages: In Project from the dropdown.
7599607--944083--In Project.png

You should see a verified version of 2D PSD Importer in your project.

What can you do?
Try it out and let us know what you think of the additions and improvements. We want to know what works as expected, what doesn’t and what is missing.

3 Likes

Nice tools.
Do you have any plans to support SpriteSkin on UGUI?

Thanks @suntabu
Are you looking for SpriteSkin support for the image component in UGUI? If so, no we currently do not have any plans for it.
If we supported this combination, how would you make use of it?

Yes, we are. We wanna reduce the usage of image resources.
Imagine this, an NPC fighting in my scene, and a dialogue panel UI with animate NPC character would be more attractive.

But for now, we need to use unity rig animation for scene characters and spine’s SkeletonGraphic for UI, which means completely duplicated character image resources.

Finally, I know we can use SpriteRenderer with UGUI, but it’s not convenient and effective.

Thanks for the insight.
Another approach you could consider is setting up a secondary camera and render it into a RenderTexture. This RenderTexture can then be assigned to a RawImage component in the UI to visualize what the secondary camera is seeing.

Using RenderTexture as RawImage’s main texture is inconvenient too.
Our game designers want to make UI very vivid and attractive, many rigged animations are displayed in UI.
So it’s very hard for every animation game object to create a camera RenderTexture.

The spine is a very popular and successful 2D animation tool and they provided SkeletonGraphic for this situation.
Why they provide SkeletonGraphic is just because they know that many many of us need it and it’s very useful.

Please reconsider this request carefully.

Thanks!

I see, good to know that you have considered this option as well.
We will take this feedback into account when planning improvements to the 2D toolset for future versions.
Thank you!

1 Like

Thanks.

Looking forward to your next improvements.

1 Like

The PSD importer is a great addition to the 2D workflow together with the animation system and am using it for a while :slight_smile:
Though I wonder is it possible to use it at runtime as well?
Thinking of modding support where I’d like to keep the .psb file of the characters in the resource folder and load them at runtime.

The triangulation and bone weights etc. would then be copied over from a dummy sprite set which has been designed inside the editor. This copying mechanism works now for psb files that have been imported in the editor, but they all have to exist at compiletime currently.
Such a runtime feature would also be helpful to allow “baking” a character at runtime. For example to provide an advanced character editor where the player can add decorations ton the character that are then animated by the regular bones of the original psb file.

Would you say that the PSD importer supports such a workflow?

Hello, I have a bug with psd importer.
Sorry, maybe I’m writing to the wrong thread, but I need your help.

I use Unity 2022.1.0b2.2474 and package Version 7.0.0-pre.3 - October 25, 2021, I have problem with layer merging.
I have psb character to rig. I want to import head as a folder in photoshop and merge it later in unity.
So, I clicked merge and all is okay, until I noticed that layers merged with semi-transparent outline.
I clicked some import options like filter mode, aniso level and etc, but no results.
One way I found - merge folder into one layer before import to unity, as I did before upgraded and Layer Management tab added.

I would be grateful for your help.


Getting a bug that makes the PSD file unreadable to unity whenever the file reimports.
Skeletal data still remains but the sprites are not generated.

Hello @Kevin_OBrien ,
Could you file a bug report for this issue, then we’ll take a closer look.
Thanks!

Have just done so, is case 1399529.

1 Like

Thanks! Would you able to share your Photoshop file for us to take a look?

Can unity psb importer leaves more space for each sprite?
When unity imports a psb file, it generate a sprite for each layer, but the problem is, it leaves zero free space for them, it squeezes each sprites into a frame that fit perfectly, this might be good for saving ram, but if I draw more stuff in that layer, it will be cut out, and I will need to redo the rig! And the auto geometry in skinning editor is not working properly because of this, some part of the sprite is not included! I have no idea why unity didn’t notice this, or is it because there is something that I don’t know?

1 Like

Thanks for the feedback @Upp000 !
This is something the users can customise in the next version of PSD Importer (Unity 2022.2).

For the second part of your comment, I would love to see this failure in action. Could you share some repro project with us?

the seco

the second half of my comment, it probably only happens when the resolution is very low, like pixel art

Thanks for the insight! If it happens again, do file a bug report so we can take a closer look.

currently, i fix all the problems I mentioned by drawing pixels on the edge of each layer, so that the whole layer would be included

1 Like

Hello, my unity version is 2021LTC
When I tried to extend PSDImporter with these codes,

namespace UnityEditor.U2D.PSD {
    [ScriptedImporter( 2, new string[0], new[] { psdExt } )]
    internal class PSDImporterOverride : PSDImporter {
        public const string psdExt = "psd";
        //public override void OnImportAsset( AssetImportContext ctx ) {
        //    base.OnImportAsset( ctx );
        //    DebugP.LogInfo( $"MyPSDImporter: {ctx.assetPath}" );
        //}
        [MenuItem( "Assets/Change PSD Importer", false, 30 )]
        static void ChangeImporter() {
            foreach ( var obj in Selection.objects ) {
                var path = AssetDatabase.GetAssetPath( obj );
                var ext = System.IO.Path.GetExtension( path ).Remove( "." );
                if ( ext != psdExt ) return;

                var Importer = GetAtPath( path );
                if ( Importer == null || Importer is PSDImporterOverride ) {
                    Debug.Log( $"imported with TextureImporter @ {path}" );
                    AssetDatabase.ClearImporterOverride( path );
                }
                else {
                    Debug.Log( $" imported with PSDImporter @ {path}" );
                    AssetDatabase.SetImporterOverride<PSDImporterOverride>( path );
                }

            }
        }
    }
    [CustomEditor( typeof( PSDImporterOverride ) )]
    internal class PSDImporterOverrideEditor : PSDImporterEditor {
    }
}

it throw out an error when I select or deselect any psd file:

NullReferenceException: Object reference not set to an instance of an object
UnityEditor.PropertyHandler.IsArrayReorderable (UnityEditor.SerializedProperty property) (at <780782bc035845f9909cebbd4c983ae3>:0)
UnityEditor.PropertyHandler.UseReorderabelListControl (UnityEditor.SerializedProperty property) (at <780782bc035845f9909cebbd4c983ae3>:0)
UnityEditor.GenericInspector.GetOptimizedGUIBlock (System.Boolean isDirty, System.Boolean isVisible, System.Single& height) (at <780782bc035845f9909cebbd4c983ae3>:0)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass59_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <3d6ac16e3c754a199373804b462a1b72>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

what’s wrong and what referece is null?