The PSD Importer is a custom Asset Importer made to import Adobe Photoshop’s PSB files into Unity. The PSB file format is functionally identical to the more common Adobe PSD format, with the additional ability to support much larger images than the PSD format (up to 300,000 by 300,000 pixels in size).
Users saving or converting their PSD working files to the PSB format can import their work with the PSD Importer, and take advantage of the additional functionality and features provided by the importer.
The following Photoshop features are not supported by the PSD Importer :
Texture Type - Default
This is the default Texture Type usage when an image is imported without a specific Texture Type selected. Refer to the documentation on Texture Types for further information and details.
Texture Type - Sprite (2D and UI)
To import a PSB file for character animation with the 2D Animation V2 package, set the Texture Type to Sprite (2D and UI) to do so.
Property settings that are specific to the PSD Importer are marked by an *.
|Texture Type||Select Sprite (2D and UI) to import the Texture as a Sprite. This is required to begin using the imported images with the 2D Animation V2 package.|
|Sprite Mode||Use this setting to specify how the the Sprite graphic is extracted from the image. The default for this option is Multiple.|
|Single||Select this option if there is only a single element in the imported image.|
|Multiple||Select this option if there are multiple elements in the imported image. Select this option when importing a character meant for animation with the 2D Animation V2 package.|
|Pixels Per Unit||The number of pixels that equal 1 Unity unit.|
|Mesh Type||This defines the Mesh type that is generated for the Sprite. The default for this option is 'Tight'.|
|Full Rect||The Sprite is mapped onto a mesh generated as a quad.|
|Tight||This generates a Mesh based on pixel alpha value of the image, generating a shape that follows the shape of the Sprite.
Note that any Sprite that is smaller than 32x32 pixels is generated on a quad Mesh, even if Tight is specified.
|Extrude Edges||Use the slider to determine how much area to leave around the Sprite in the generated Mesh.|
|* Import Hidden||Select this property to specify that hidden layers in the PSB file should be imported. Clear this option to not import the hidden layers.|
|* Mosaic||This option is only available if Texture Type is set to ‘Multiple’. Enable this to allow Unity to create a Sprite from each imported layer and arrange them into a Sprite Sheet layout.|
|* Character Rig||Select the imported image(s) is to be used for a multi-Sprite character. When selected, a Prefab containing the imported images is generated.|
|* Use Layer Grouping||Select to have the generated Prefab mimic the layer hierarchy of the imported PSB file.|
|Pivot||Select the pivot point of the Sprite from the dropdown menu options.|
|Custom||Define the X and Y coordinates of a custom Pivot location.|
|* Reslice||Available only when Mosaic is enabled.
Select this to clear away all previous Sprite metadata and recreate the Sprite from the imported PSB layers.
The PSD Importer can store 4 possible sets of SpriteRect data, depending on the properties selected when importing an image.
The 4 sets are created by enabling the following property combinations:
Sprite Mode: Single
Sprite Mode: Multiple
Sprite Mode: Multiple + Mosaic
Sprite Mode: Multiple + Mosaic + Character Rig
User defined SpriteRect
When the user manually creates a SpriteRect in the Sprite Editor window, the SpriteRect persists even when the Asset has changed. It persists until the user manually deletes the SpriteRect or reimports it with the Reslice option. The position of the SpriteRect does not change even when the size the Mosaic texture changes.
Modifying the SpriteRect in the Sprite Editor window
Any modification to a SpriteRect generated from an imported layer will persist and follow wherever the layer is placed in a Mosaic texture, even if it is reimported.
|A generated SpriteRect with an imported Layer Sprite that has been modified.||The modified SpriteRect follows where the layer is placed.|
If the name of the generated SpriteRect is changed, the changed name persists and changes to the layer in the source file are not reflected.
If the generated SpriteRect is deleted, it is regenerated when its source layer is reimported, and the source layer both exists and is visible in the source file.
Effect on SpriteRect when source files are modified
|New layer added /Layer visibility turned on||A new Sprite is automatically generated from the new layer.|
|Layer deleted /Layer visibility turned off||The Sprite and SpriteRect that was generated from the layer are deleted.|
|Layer name changed||The changed layer name is copied to the generated SpriteRect, if the SpriteRect's original name has not been modified by the user.|
|Layer or canvas size changed||The SpriteRects size does not change reflect changes made to the layer or canvas size in the source file. regardless if it was modified by the user. To have the SpriteRect reflect the changed size, manually edit the size or select the Reslice option.|
When this is selected, layers that are hidden are imported. The behavior is identical to the user unhiding all layers in the PSB file before import.
When Mosaic is selected, all layers in the PSB file will be imported as separate Sprites.
When this is selected, a Prefab is generated containing a Sprite GameObject with the SpriteRenderer component. If the Sprite contains bone and skin data, the Sprite Skin component is added as well. The name of the GameObject is the same as the name specified in it's SpriteRect.
When this is selected, the generated GameObjects mimic the layer grouping in the imported file. When the Asset hierarchy is modified, it is reflected on the next import.
When this is selected, all user modification is discarded and SpriteRects are regenerated based on the current source file data. Extra SpriteRect meta data (e.g. Weights, Bones) persist if they remain valid after the SpriteRects are regenerated.
Name collision errors
A name collision can occur in the following ways:
2 or more layers in the Asset has the same name. This does not affect Photoshop group name.
A new layer created in the Asset has the same name as a user created SpriteRect.
A layer renamed to the same name as user created SpriteRect.
A previously hidden layer is imported and has the same name as an existing SpriteRect.
When a name collision occurs, one SpriteRect retains the original name while the rest will be appended with a running number. Which SpriteRect retains their original name is based on the following priority order:
A user created SpriteRect.
The first layer in the file, starting from the bottom of the stack.
Currently existing SpriteRects.