Fix for IndexOutOfRangeException: Index was outside the bounds of the array

This commit is contained in:
Marllon Vilano 2024-02-19 13:42:33 -03:00
parent 41e493b7c3
commit 0a3b5dbb31

View File

@ -374,7 +374,12 @@ namespace Spine.Unity.Editor {
public void DeletePlaceholderTextures (GenericOnDemandTextureLoader<TargetReference, TextureRequest> loader) {
foreach (var materialMap in loader.placeholderMap) {
Texture texture = materialMap.textures[0].placeholderTexture;
var textures = materialMap.textures;
if (textures == null || textures.Length == 0) {
continue;
}
Texture texture = textures[0].placeholderTexture;
if (texture)
AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(texture));
}