mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-20 09:16:01 +08:00
[unity] OnDemandTextureLoader: Added TextureLoadFailed callback, used by Addressables extension package.
This commit is contained in:
parent
e076a1c7d9
commit
2f44b90878
@ -89,6 +89,7 @@ namespace Spine.Unity {
|
||||
public delegate void TextureLoadDelegate (OnDemandTextureLoader loader, Material material, int textureIndex);
|
||||
protected event TextureLoadDelegate onTextureRequested;
|
||||
protected event TextureLoadDelegate onTextureLoaded;
|
||||
protected event TextureLoadDelegate onTextureLoadFailed;
|
||||
protected event TextureLoadDelegate onTextureUnloaded;
|
||||
|
||||
public event TextureLoadDelegate TextureRequested {
|
||||
@ -99,6 +100,10 @@ namespace Spine.Unity {
|
||||
add { onTextureLoaded += value; }
|
||||
remove { onTextureLoaded -= value; }
|
||||
}
|
||||
public event TextureLoadDelegate TextureLoadFailed {
|
||||
add { onTextureLoadFailed += value; }
|
||||
remove { onTextureLoadFailed -= value; }
|
||||
}
|
||||
public event TextureLoadDelegate TextureUnloaded {
|
||||
add { onTextureUnloaded += value; }
|
||||
remove { onTextureUnloaded -= value; }
|
||||
@ -112,6 +117,10 @@ namespace Spine.Unity {
|
||||
if (onTextureLoaded != null)
|
||||
onTextureLoaded(this, material, textureIndex);
|
||||
}
|
||||
protected void OnTextureLoadFailed (Material material, int textureIndex) {
|
||||
if (onTextureLoadFailed != null)
|
||||
onTextureLoadFailed(this, material, textureIndex);
|
||||
}
|
||||
protected void OnTextureUnloaded (Material material, int textureIndex) {
|
||||
if (onTextureUnloaded != null)
|
||||
onTextureUnloaded(this, material, textureIndex);
|
||||
|
||||
@ -87,6 +87,8 @@ namespace Spine.Unity {
|
||||
materialToUpdate.mainTexture = loadedTexture;
|
||||
OnTextureLoaded(materialToUpdate, textureIndex);
|
||||
if (onTextureLoaded != null) onTextureLoaded(loadedTexture);
|
||||
} else {
|
||||
OnTextureLoadFailed(materialToUpdate, textureIndex);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"name": "com.esotericsoftware.spine.addressables",
|
||||
"displayName": "Spine Addressables Extensions [Experimental]",
|
||||
"description": "This experimental plugin provides integration of Addressables on-demand texture loading for the spine-unity runtime.\nPlease be sure to test this package first and create backups of your project before using.\n\nUsage: First declare your target Material textures as addressable. Then select the SpineAtlasAsset, right-click the SpineAtlasAsset Inspector heading and select 'Add Addressables Loader'. This generates an 'AddressableTextureLoader' asset providing configuration parameters and sets up low-resolution placeholder textures which are automatically assigned in a pre-build step when building your game executable.\n\nPrerequisites:\nIt requires a working installation of the spine-unity runtime (via the spine-unity unitypackage), version 4.2.\n(See http://esotericsoftware.com/git/spine-runtimes/spine-unity)",
|
||||
"version": "4.2.0-preview.3",
|
||||
"version": "4.2.0-preview.4",
|
||||
"unity": "2018.3",
|
||||
"author": {
|
||||
"name": "Esoteric Software",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user