Twenty Five Slicer is a Unity package designed for more advanced sprite slicing, enabling a "25-slice" approach. It divides a sprite into a 5x5 grid, allowing precise scaling and manipulation of individual regions while preserving key areas.
- 9 slices: Non-stretchable areas.
- 6 slices: Stretch horizontally only.
- 6 slices: Stretch vertically only.
- 4 slices: Stretch in both directions.
This allows for far more detailed slicing. Where traditional 9-slice images often require stacking multiple image layers to achieve complex UI shapes (e.g., speech bubbles, boxes with icons or separators at the center), a 25-slice configuration can often handle these scenarios with just a single image.
- Open the Unity Package Manager.
- Select Add package from Git URL.
- Enter:
https://github.com/kwan3854/twentyfiveslicer.git
- To install a specific version, append a version tag:
https://github.com/kwan3854/twentyfiveslicer.git#v1.0.0
- Navigate to the
Assets/Resources
folder. (Create the folder if it doesn’t exist.) - Right-click -> Create -> TwentyFiveSlicer -> SliceDataMap
- Open the 25-Slice Editor:
- Window -> 2D -> 25-Slice Editor
- Load Your Sprite:
- Drag and drop your sprite into the editor or select it via the provided field.
- Adjust the Slices:
- Use the sliders to define the horizontal and vertical cut lines, dividing the sprite into 25 sections.
- Borders are displayed visually for accurate adjustments.
- Save the Configuration:
- Click Save Borders to store the 25-slice settings.
- Create a TwentyFiveSliceImage GameObject (or add the component to an existing GameObject):
- Assign the Sliced Sprite:
- In the
TwentyFiveSliceImage
component, assign the sprite as you would with a standard UI Image.
- Divide sprites into a 5x5 grid for highly detailed control.
- Seamlessly scale and stretch specific sprite regions.
- Fully compatible with Unity’s UI system for dynamic layouts.
- Intuitive editor with clear visual guidance for precise adjustments.
For more information or contributions, visit the repository.
Tools -> Twenty Five Slicer Tools -> Slice Data Cleaner