2D Sprite Shape
Overview
The Sprite Shape is a flexible and powerful world building Asset that features Sprite tiling along a shape's outline that automatically deforms and swaps Sprites based on the angle of the outline. Additionally, you can assign a Fill texture to a Sprite Shape to create filled shapes with tiled textures as backgrounds or other large level-building props.
The following are examples of Sprite Shapes used to construct different parts of various levels.
Sprite Shapes comprise of two parts - the Sprite Shape Profile Asset, and the Sprite Shape Controller component. The Sprite Shape Profile contains the angle settings and Sprites used by the Sprite Shape, and you edit the Sprite Shape's outline with the Sprite Shape Controller component.
Importing Sprites for Sprite Shapes
When importing Sprites, use the following property settings to ensure that the Sprites are compatible for use with Sprite Shape:
- Texture Type - Set this to ‘Sprite (2D and UI)’. Other Texture types are not supported for Sprite Shapes.
- Sprite Mode - Set this to ‘Single’ if the Texture contains only a single Sprite.
- Mesh Type - This must be set to Full Rect for the Sprite to be used with Sprite Shape.
In addition, if the Sprites used for the Sprite Shape are part of a Sprite Atlas, disable both Allow Rotation and Tight Packing options under the Sprite Atlas’ properties so that the Sprites can be used by the Sprite Shape.
Creating a Sprite Shape general workflow
Create Sprite Shapes with the following steps:
- Create a Sprite Shape GameObject from the main GameObject menu (menu: GameObject > 2D Object > Sprite Shape) and select from the two available options:
- Edit the outline of the Sprite Shape with the Sprite Shape Controller component settings.
- Enable Physics 2D interactions for your Sprite Shapes by attaching a Collider component.
To further customize the shape and outline of a Sprite Shape:
- Create a Sprite Shape Profile from the main menu (menu: Assets > Create > 2D > Sprite Shape Profile).
- Create Angle Ranges and assign Sprites in the Sprite Shape Profile.
- Assign the Sprite Shape Profile to a Sprite Shape Controller's Profile settings. The same Profile can be used by multiple Sprite Shapes.