Interface ITextureDataProvider
Data provider that provides texture data needed for Sprite Editor Window.
Namespace: UnityEditor .U2D.Sprites
Assembly: Unity.2D.Sprite.Editor.dll
Syntax
public interface ITextureDataProvider
Properties
previewTexture
Texture2D that represents the preview for ITextureDataProvider.texture.
Declaration
Texture2D previewTexture { get; }
Property Value
Type | Description |
---|---|
Texture2D |
texture
Texture2D representation of the data provider.
Declaration
Texture2D texture { get; }
Property Value
Type | Description |
---|---|
Texture2D |
Methods
GetReadableTexture2D()
Readable version of ITextureProvider.texture.
Declaration
Texture2D GetReadableTexture2D()
Returns
Type | Description |
---|---|
Texture2D | Texture2D that is readable. |
GetTextureActualWidthAndHeight(out int, out int)
The actual width and height of the texture data.
Declaration
void GetTextureActualWidthAndHeight(out int width, out int height)
Parameters
OverrideTextures(Texture2D, Texture2D, int, int)
Overrides the texture data with the given textures.
Declaration
bool OverrideTextures(Texture2D mainTexture, Texture2D previewTexture, int width, int height)
Parameters
Type | Name | Description |
---|---|---|
Texture2D | mainTexture | Main texture data to override. |
Texture2D | previewTexture | Preview texture data to override. |
int | width | Width of the override source texture. |
int | height | Height of the override source texture. |
Returns
Type | Description |
---|---|
bool | Returns true if override is successful, false otherwise |
RegisterDataChangeCallback(Action<ITextureDataProvider>)
Register callback for data change.
Declaration
void RegisterDataChangeCallback(Action<ITextureDataProvider> action)
Parameters
Type | Name | Description |
---|---|---|
Action<ITexture |
action | Callback delegate. |
RegisterSourceTextureOverride(Action<string>)
Registers a callback to override the source texture.
Declaration
void RegisterSourceTextureOverride(Action<string> action)
Parameters
Type | Name | Description |
---|---|---|
Action<string> | action | Callback that will write to the source texture with the path of the source texture. |
UnregisterDataChangeCallback(Action<ITextureDataProvider>)
Unregister callback for data change.
Declaration
void UnregisterDataChangeCallback(Action<ITextureDataProvider> action)
Parameters
Type | Name | Description |
---|---|---|
Action<ITexture |
action | Callback delegate. |
UnregisterSourceTextureOverride(Action<string>)
Unregister a callback to override the source texture.
Declaration
void UnregisterSourceTextureOverride(Action<string> action)