Class SpriteBorderWriter
Reads and writes a UnityEngine.Sprite's 9-slice border through its UnityEditor.TextureImporter, so a wizard or designer can generate a Sliced-mode Image against a sprite that was never manually sliced. Every entry point is non-throwing: a sprite that cannot carry borders (built-in, procedural, or part of a Multiple-mode atlas) is skipped with a warning string instead of failing the whole caller over one sprite.
Inherited Members
Namespace: Serenity.Ui.Installation.Editor.Settings.Builder
Assembly: Serenity.UnityUi.Installation.Editor.dll
Syntax
public static class SpriteBorderWriter
Remarks
Shared across modules: the Theme Builder's sprite-slot fields (CreateThemeWindow.DrawSpriteSlotFields)
and the Leaderboard View Designer's background block (LeaderboardViewBackgroundGui) both write
borders through this same importer I/O rather than each rolling its own.
Methods
EnsureBorders(Sprite, Vector4)
Writes requested into the sprite's UnityEditor.TextureImporter if it
differs from what is already there. Returns a human-readable warning when the write was skipped, or
null on success/no-op.
Declaration
public static string EnsureBorders(Sprite sprite, Vector4 requested)
Parameters
| Type | Name | Description |
|---|---|---|
| Sprite | sprite | |
| Vector4 | requested |
Returns
| Type | Description |
|---|---|
| string |
ReadBorders(Sprite)
Current importer spriteBorder, or zero when it cannot be read (used to prefill a
wizard's or designer's border fields when a slicing mode is first selected).
Declaration
public static Vector4 ReadBorders(Sprite sprite)
Parameters
| Type | Name | Description |
|---|---|---|
| Sprite | sprite |
Returns
| Type | Description |
|---|---|
| Vector4 |