Interface ISpriteEditorDataProvider
An interface that allows Sprite Editor Window to edit Sprite data for user custom importer.
Namespace: UnityEditor.U2D.Sprites
Syntax
public interface ISpriteEditorDataProvider
Remarks
Implement this interface for [[ScriptedImporter]] to leverage on Sprite Editor Window to edit Sprite data.
Properties
pixelsPerUnit
The number of pixels in the sprite that correspond to one unit in world space.
Declaration
float pixelsPerUnit { get; }
Property Value
| Type | Description |
|---|---|
| Single |
spriteImportMode
SpriteImportMode to indicate how Sprite data will be imported.
Declaration
SpriteImportMode spriteImportMode { get; }
Property Value
| Type | Description |
|---|---|
| SpriteImportMode |
targetObject
The object that this data provider is acquiring its data from.
Declaration
Object targetObject { get; }
Property Value
| Type | Description |
|---|---|
| Object |
Methods
Apply()
Applying any changed data.
Declaration
void Apply()
GetDataProvider<T>()
Gets other data providers that might be supported by ISpriteEditorDataProvider.targetObject.
Declaration
T GetDataProvider<T>()
where T : class
Returns
| Type | Description |
|---|---|
| T | Data provider type. |
Type Parameters
| Name | Description |
|---|---|
| T | The data provider type to acquire. |
GetSpriteRects()
Returns an array of SpriteRect representing Sprite data the provider has.
Declaration
SpriteRect[] GetSpriteRects()
Returns
| Type | Description |
|---|---|
| SpriteRect[] | Array of SpriteRect. |
HasDataProvider(Type)
Queries if ISpriteEditorDataProvider.targetObject supports the data provider type.
Declaration
bool HasDataProvider(Type type)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | type | Data provider type. |
Returns
| Type | Description |
|---|---|
| Boolean | True if supports, false otherwise. |
InitSpriteEditorDataProvider()
Allows the data provider to initialize any data if needed.
Declaration
void InitSpriteEditorDataProvider()
SetSpriteRects(SpriteRect[])
Sets the data provider's current SpriteRect.
Declaration
void SetSpriteRects(SpriteRect[] spriteRects)
Parameters
| Type | Name | Description |
|---|---|---|
| SpriteRect[] | spriteRects | Updated array of SpriteRect. |